home *** CD-ROM | disk | FTP | other *** search
/ Complete Linux / Complete Linux.iso / docs / apps / database / ingres04.lzh / doc / other / design.doc next >
Encoding:
Text File  |  1992-12-11  |  108.6 KB  |  2,206 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.                             THE DESIGN AND IMPLEMENTATION
  10.                                       OF INGRES
  11.  
  12.                                          by
  13.  
  14.                   MICHAEL STONEBRAKER, EUGENE WONG AND PETER KREPS
  15.               DEPARTMENT OF ELECTRICAL ENGINEERING AND COMPUTER SCIENCE
  16.                        UNIVERSITY OF CALIFORNIA, BERKELEY, CA.
  17.  
  18.                                          and
  19.  
  20.                                      GERALD HELD
  21.                                TANDEM COMPUTERS, INC.
  22.                                    CUPERTINO, CA.
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.                                       ABSTRACT
  33.  
  34.               This paper describes the CURRENTLY OPERATIONAL version of the
  35.           INGRES data base management system.  This multi-user system gives
  36.           a relational view of data, supports two high level non-procedural
  37.           data  sublanguages and  runs  as  a  collection of user processes
  38.           on top of the UNIX operating system. Stressed here are the design
  39.           decisions and tradeoffs related to 1) structuring the system into
  40.           processes, 2) embedding one command language in a general purpose
  41.           programming language, 3) the algorithms  implemented  to  process
  42.           interactions, 4) the access methods implemented 5) the concurren-
  43.           cy and recovery control provided 6) support for views, protection
  44.           and  integrity  constraints  and  7) the data structures used for
  45.           system catalogs and role of the data base administrator.
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.           1  INTRODUCTION
  62.  
  63.           INGRES (Interactive Graphics and Retrieval System) is a relation-
  64.           al  data  base  system  which  is  implemented on top of the UNIX
  65.           operating  system  developed  at  Bell   Telephone   Laboratories
  66.           [RITC74]  for  Digital Equipment Corporation PDP 11/40, 11/45 and
  67.           11/70 computer systems.  The implementation of INGRES is primari-
  68.           ly  programmed in "C", a high level language in which UNIX itself
  69.           is written.  Parsing is done  with  the  assistance  of  YACC,  a
  70.           compiler-compiler available on UNIX [JOHN74].
  71.  
  72.           The advantages of a relational model  for  data  base  management
  73.           systems  have  been  extensively  discussed  in  the  literature,
  74.           [CODD70,CODD74,DATE74] and hardly  require  further  elaboration.
  75.           In  choosing the relational model, we were particularly motivated
  76.           by (a) the high degree of data independence that such a model af-
  77.           fords,  and (b) the possibility of providing a high level and en-
  78.           tirely procedure-free facility for  data  definition,  retrieval,
  79.           update, access control, support of views, and integrity verifica-
  80.           tion.
  81.  
  82.           In this paper we will  describe  the  design  decisions  made  in
  83.           INGRES.  In particular, we will stress the design and implementa-
  84.           tion of:
  85.  
  86.           a) the embedding of all INGRES commands in  the  general  purpose
  87.           programming language "C"
  88.  
  89.           b) the access methods implemented
  90.  
  91.           c) the catalog structure and the role of the data  base  adminis-
  92.           trator
  93.  
  94.           d) support for views, protection and integrity constraints
  95.  
  96.           e) the decomposition procedure implemented
  97.  
  98.           f) implementation of updates and consistency of secondary indices
  99.  
  100.           g) recovery and concurrency control
  101.  
  102.           Except where noted to the  contrary,  this  paper  describes  the
  103.           INGRES system operational in January, 1976.
  104.  
  105.           To this end we first briefly describe in Section 1.2 the  primary
  106.           query language supported, QUEL, and the utility commands accepted
  107.           by the current system. The second user  interface,  CUPID,  is  a
  108.           graphics oriented, casual user language which is also operational
  109.           and described in [MCDO75a, MCDO75b].  It will  not  be  discussed
  110.           further  in  this  paper.   Then  in  Section 1.3 we describe the
  111.           relevant factors in the UNIX environment which have affected  our
  112.           design decisions.
  113.  
  114.           In Section 2 we discuss the structure of the four processes  (see
  115.           Section  1.3  for  a  discussion  of this UNIX notion) into which
  116.           INGRES is divided and the reasoning behind the choice  implement-
  117.           ed.  The EQUEL (Embedded QUEL) precompiler, which allows the sub-
  118.           stitution of a user-supplied C program for the "front  end"  pro-
  119.           cess is also discussed.  This program has the effect of embedding
  120.           all of INGRES in the general purpose  programming  language  "C".
  121.           Then  in  Section 3 we indicate the data structures which are im-
  122.           plemented in INGRES, the catalog (system) relations  which  exist
  123.           and  the  role of the data base administrator with respect to all
  124.           relations in a data base.  The implemented access methods,  their
  125.           calling  conventions,  and  the  actual  layout  of data pages in
  126.           secondary storage where appropriate, are also presented.
  127.  
  128.           Sections 4, 5 and 6 discuss respectively the various functions of
  129.           each of the three "core" processes in the system.  Also discussed
  130.           are the design  and  implementation  strategy  of  each  process.
  131.           Lastly,  Section  7 draws conclusions, suggests future extensions
  132.           and indicates the nature  of  the  current  applications  run  on
  133.           INGRES.
  134.  
  135.           1.2 QUEL AND THE OTHER INGRES UTILITY COMMANDS
  136.  
  137.           QUEL  (QUEry  Language)  has   points   in   common   with   Data
  138.           Language/ALPHA  [CODD71],  SQUARE [BOYC73] and SEQUEL [CHAM74] in
  139.           that it is a complete [CODD72] query  language  which  frees  the
  140.           programmer  from  concern for how data structures are implemented
  141.           and what algorithms are operating on stored data.  As such it fa-
  142.           cilitates a considerable degree of data independence [STON74a].
  143.  
  144.           The QUEL examples in this section all concern the following rela-
  145.           tion.
  146.  
  147.                       NAME     DEPT     SALARY      MANAGER      AGE
  148.  
  149.                       Smith    toy      10000       Jones        25
  150.           EMPLOYEE    Jones    toy      15000       Johnson      32
  151.                       Adams    candy    12000       Baker        36
  152.                       Johnson  toy      14000       Harding      29
  153.                       Baker    admin    20000       Harding      47
  154.                       Harding  admin    40000       none         58
  155.  
  156.           Indicated here is an EMPLOYEE relation with domains  NAME,  DEPT,
  157.           SALARY, MANAGER and AGE.  Each employee has a manager (except for
  158.           Harding who is presumably the company president),  a  salary,  an
  159.           age, and is in a department.
  160.  
  161.           A QUEL interaction includes at least one RANGE statement  of  the
  162.           form:
  163.  
  164.                   RANGE OF variable-list IS relation-name
  165.  
  166.           The symbols declared in the range statement are  variables  which
  167.           will  be  used  as  arguments for tuples.  These are called TUPLE
  168.           VARIABLES.  The purpose of this statement is to specify the rela-
  169.           tion over which each variable ranges.
  170.  
  171.           Moreover, an interaction includes one or more statements  of  the
  172.           form:
  173.  
  174.                   Command [Result-name] ( Target-list  )
  175.                       [ WHERE Qualification ]
  176.  
  177.           Here, Command is either RETRIEVE,  APPEND,  REPLACE,  or  DELETE.
  178.           For  RETRIEVE and APPEND, Result-name is the name of the relation
  179.           which qualifying tuples will be retrieved into  or  appended  to.
  180.           For  REPLACE and DELETE, Result-name is the name of a tuple vari-
  181.           able which, through the qualification, identifies  tuples  to  be
  182.           modified or deleted.  The Target-list is a list of the form
  183.  
  184.                   Result-domain = Function ...
  185.  
  186.           Here, the Result-domain's are domain names in the result relation
  187.           which are to be assigned the value of the corresponding function.
  188.  
  189.           The  following  suggest  valid  QUEL  interactions.   A  complete
  190.           description of the language is presented in [HELD75a].
  191.  
  192.           Example 1.1     Find the birth year of employee Jones
  193.  
  194.                   RANGE OF E IS EMPLOYEE
  195.               RETRIEVE INTO W  (BYEAR  = 1975 - E.AGE)
  196.                 WHERE E.NAME = "Jones"
  197.  
  198.           Here, E is a tuple variable which ranges over the EMPLOYEE  rela-
  199.           tion  and all tuples in that relation are found which satisfy the
  200.           qualification E.NAME = "Jones".  The result of the query is a new
  201.           relation, W, which has a single domain, BYEAR, that has been cal-
  202.           culated for each qualifying tuple.  If the result relation is om-
  203.           itted,  qualifying  tuples  are  written in display format on the
  204.           user's terminal or returned to a calling program in a  prescribed
  205.           format  as discussed in Section 2.  Also, in the Target-list, the
  206.           "Result-domain =" may be omitted if Function is  the  right  hand
  207.           side  is an existing domain (i.e. NAME = E.NAME may be written as
  208.           E.NAME -- see example 1.6).
  209.  
  210.           Example 1.2    Insert  the  tuple  (Jackson,candy,13000,Baker,30)
  211.           into EMPLOYEE.
  212.  
  213.                   APPEND TO EMPLOYEE(NAME  =  "Jackson",  DEPT  =  "candy",
  214.                           SALARY = 13000, MGR = "Baker", AGE = 30)
  215.  
  216.           Here, the result relation EMPLOYEE is modified by adding the  in-
  217.           dicated  tuple to the relation. If not all domains are specified,
  218.           the remainder default to zero for numeric domains  and  null  for
  219.           character strings.
  220.  
  221.           Example 1.3    If a second relation DEPT(DEPT,  FLOOR#)  contains
  222.           the  floor#  of  each  department that an employee might work in,
  223.           then one can fire everybody on the first floor as follows:
  224.  
  225.                   RANGE OF  E  IS  EMPLOYEE
  226.               RANGE  OF  D  IS  DEPT
  227.                   DELETE E WHERE  E.DEPT = D.DEPT AND D.FLOOR# = 1
  228.  
  229.           Here E specifies that the EMPLOYEE relation is  to  be  modified.
  230.           All tuples are to be removed which have a value for DEPT which is
  231.           the same as some department of the first floor.
  232.  
  233.           Example 1.4    Give a 10 percent raise to Jones if  he  works  on
  234.           the first floor
  235.  
  236.  
  237.                   RANGE OF  E  IS  EMPLOYEE          
  238.           RANGE  of  D  is  DEPT
  239.                   REPLACE  E(SALARY BY 1.1 * E.SALARY)
  240.             WHERE E.NAME = "Jones" AND
  241.                         E.DEPT = D.DEPT AND D.FLOOR# = 1
  242.  
  243.  
  244.           Here, E.SALARY is to be replaced by 1.1*E.SALARY for those tuples
  245.           in EMPLOYEE where the qualification is true.  (Note that the key-
  246.           words IS and BY may be used interchangeably with "=" in any  QUEL
  247.           statement.)
  248.  
  249.           Also, QUEL contains aggregation operators including  COUNT,  SUM,
  250.           MAX,  MIN,  and AVG.  Two examples of the use of aggregation fol-
  251.           low.
  252.  
  253.           Example 1.5    Replace the salary of all toy department employees
  254.           by the average toy department salary.
  255.  
  256.                   RANGE  OF  E  IS  EMPLOYEE
  257.               REPLACE E(SALARY BY AVG(E.SALARY WHERE E.DEPT = "toy") )
  258.                    WHERE E.DEPT = "toy"
  259.  
  260.           Here, AVG is to be taken of the salary domain  for  those  tuples
  261.           satisfying   the   qualification   E.DEPT  =  "toy".   Note  that
  262.           AVG(E.SALARY WHERE E.DEPT= "toy") is scalar valued (in  this  in-
  263.           stance,  $13,000)  and  consequently will be called an AGGREGATE.
  264.           More general aggregations are possible as suggested by  the  fol-
  265.           lowing example.
  266.  
  267.           Example 1.6      Find  those  departments  whose  average  salary
  268.           exceeds the company wide average salary, both averages to be tak-
  269.           en only for those employees whose salary exceeds $10000.
  270.  
  271.                   RANGE OF E  IS  EMPLOYEE 
  272.               RETRIEVE  INTO  HIGHPAY (E.DEPT)
  273.                   WHERE   AVG(E.SALARY BY E.DEPT WHERE E.SALARY >
  274.                       10000) > AVG(E.SALARY   WHERE
  275.                       E.SALARY > 10000)
  276.  
  277.           Here, AVG(E.SALARY BY E.DEPT WHERE E.SALARY>10000) is  an  AGGRE-
  278.           GATE  FUNCTION  and takes a value for each value of E.DEPT.  This
  279.           value is the aggregate   AVG(E.SALARY  WHERE  E.SALARY>10000  AND
  280.           E.DEPT  = value).  (For the toy, candy and admin departments this
  281.           value is respectively 14,500, 12,000 and 30,000.) The  qualifica-
  282.           tion  expression  for  the statement is then true for departments
  283.           for  which  this  aggregate  function   exceeds   the   aggregate
  284.           AVG(E.SALARY WHERE E.SALARY>10000).
  285.  
  286.           In addition to the above QUEL commands  INGRES  also  supports  a
  287.           variety of utility commands These utility commands can be classi-
  288.           fied into seven major categories.
  289.  
  290.           a) invocation of INGRES
  291.  
  292.              INGRES data-base-name
  293.  
  294.           This command executed from UNIX "logs in" a user to a given  data
  295.           base. (A data base is simply a named collection of relations with
  296.           a given data base administrator who has powers not  available  to
  297.           ordinary  users.)  Thereafter,  the user may issue all other com-
  298.           mands (except those executed directly from UNIX) within  the  en-
  299.           vironment of the invoked data base.
  300.  
  301.           b) creation and destruction of data bases
  302.  
  303.              CREATEDB data-base-name
  304.              DESTROYDB data-base-name
  305.  
  306.           These two commands are called from UNIX.  The invoker of CREATEDB
  307.           must  be  authorized  to  create  data  bases  (in a manner to be
  308.           described presently) and he automatically becomes the  data  base
  309.           administrator.   DESTROYDB successfully destroys a data base only
  310.           if invoked by the data base administrator.
  311.  
  312.           c) creation and destruction of relations
  313.  
  314.              CREATE relname(domain-name IS format, domain-name IS format,...)
  315.              DESTROY relname
  316.  
  317.           These commands create and destroy relations  within  the  current
  318.           data base.  The invoker of the CREATE command becomes the "owner"
  319.           of the relation created.  A user may only destroy a relation that
  320.           he  owns.   The current formats accepted by INGRES are 1, 2 and 4
  321.           byte integers, 4 and 8 byte  floating  point  numbers  and  fixed
  322.           length ASCII character strings between 1 and 255 bytes.
  323.  
  324.           d) bulk copy of data
  325.  
  326.              COPY relname(domain-name IS format, domain-name IS format,...)
  327.                direction  "filename"
  328.  
  329.              PRINT relname
  330.  
  331.           The command COPY transfers an entire relation to or from  a  UNIX
  332.           file  whose  name  is  "filename".   Direction  is either "TO" or
  333.           "FROM".  The format for each domain is a description  of  how  it
  334.           appears (or is to appear) in the UNIX file.  The relation relname
  335.           must exist and have domain names identical to the ones  appearing
  336.           in  the  COPY  command.   However, the formats need not agree and
  337.           COPY will automatically convert data  types.   Also,  support  is
  338.           provided for dummy and variable length fields in a UNIX file.
  339.  
  340.           PRINT copies a relation onto the user's terminal formatting it as
  341.           a report.  In this sense, it is stylized version of COPY.
  342.  
  343.           e) storage structure modification
  344.  
  345.              MODIFY relname TO storage-structure ON (key1, key2,...)
  346.              INDEX ON relname IS indexname(key1, key2,...)
  347.  
  348.           The MODIFY command changes the storage structure  of  a  relation
  349.           from  one  access  method  to  another.   The five access methods
  350.           currently supported are discussed in Section  2.   The  indicated
  351.           keys  are domains in relname which are concatenated left to right
  352.           to form a combined key which is used in the organization  of  tu-
  353.           ples  in  all but one of the access methods.  Only the owner of a
  354.           relation may modify its storage structure.
  355.  
  356.           INDEX creates a secondary index for a relation .  It has  domains
  357.           of  key1,  key2,...,pointer.  The domain, pointer, is the address
  358.           of a tuple in the indexed relation having the  given  values  for
  359.           key1,  key2,....   An  index named AGEINDEX for EMPLOYEE would be
  360.           the following binary relation
  361.  
  362.                           AGE            POINTER
  363.  
  364.                           25      address of Smith's tuple
  365.                           32      address of Jones' tuple
  366.             AGEINDEX      36      address of Adams' tuple
  367.                           29      address of Johnson's tuple
  368.                           47      address of Baker's tuple
  369.                           58      address of Harding's tuple
  370.  
  371.  
  372.           The relation indexname is in turn treated and accessed just  like
  373.           any  other  relation except that it is automatically updated when
  374.           the relation it indexes is updated.  This is discussed further in
  375.           Section  6.   Naturally,  only the owner of a relation may create
  376.           and destroy secondary indexes for it.
  377.  
  378.           f) consistency and integrity control
  379.  
  380.              INTEGRITY CONSTRAINT is qualification
  381.              INTEGRITY CONSTRAINT LIST relname
  382.              INTEGRITY CONSTRAINT OFF relname
  383.              INTEGRITY CONSTRAINT OFF (integer, ... ,integer)
  384.              RESTORE data-base-name
  385.  
  386.           The first four commands support the insertion, listing,  deletion
  387.           and  selective  deletion of integrity constraints which are to be
  388.           enforced for all interactions with a relation.  The mechanism for
  389.           handling  this  enforcement  is  dicussed in Section 4.  The last
  390.           command restores a data base to a consistent state after a system
  391.           crash.   It  must be executed from UNIX and its operation is dis-
  392.           cussed in Section 6.  The RESTORE command is  only  available  to
  393.           the data-base administrator.
  394.  
  395.           g) miscellaneous
  396.  
  397.              HELP [relname|manual-section]
  398.              SAVE relname UNTIL expiration-date
  399.              RELKILLER  data-base-name
  400.  
  401.           HELP provides information about the system or the data  base  in-
  402.           voked.   When called with an optional argument which is a command
  403.           name, HELP will return  the  appropriate  page  from  the  INGRES
  404.           reference  manual  [ZOOK75].  When called with a relation name as
  405.           an argument, it returns  all  information  about  that  relation.
  406.           With  no  argument  at all it returns information about all rela-
  407.           tions in the current data base.
  408.  
  409.           SAVE is the mechanism by which a user can declare  his  intention
  410.           to  keep  a relation until a specified time.  RELKILLER is a UNIX
  411.           command which can be invoked by  a  data  base  administrator  to
  412.           delete  all relations whose "expiration-dates" have passed.  This
  413.           should be done when space in a data base is exhausted.  (The data
  414.           base  administrator  can  also remove any relations from his data
  415.           base using the DESTROY command, regardless of  who  their  owners
  416.           are.)
  417.  
  418.           Two comments should be noted at this time.
  419.  
  420.           a) The system currently accepts the language specified  as  QUEL1
  421.           in [HELD75a].  Extension is in progress to accept QUELn.
  422.  
  423.           b) The system currently  does  not  accept  views  or  protection
  424.           statements.    Although   the   algorithms  have  been  specified
  425.           [STON74b,STON75], they have not yet been implemented.   For  this
  426.           reason,  no syntax for these statements is given in this section;
  427.           however the subject is dicussed further in Section 4.
  428.  
  429.           1.3  THE UNIX ENVIRONMENT
  430.  
  431.           Two points concerning UNIX are worthy of mention in this section.
  432.  
  433.           a) The UNIX file system
  434.  
  435.           UNIX supports a tree structured file system similar  to  that  of
  436.           MULTICS.   Each file is either a directory (containing references
  437.           to descendant files in the file system) or  a  data  file.   Each
  438.           data  file  can be viewed as an array 1 byte wide and 2**24 bytes
  439.           long. (It is expected that this maximum length will be  increased
  440.           by the UNIX implementors.) Addressing in a file is similar to re-
  441.           ferencing such an array.  Physically, each file is  divided  into
  442.           512  byte  blocks  (pages).   In response to a read request, UNIX
  443.           moves one or more  pages  from  secondary  memory  to  UNIX  core
  444.           buffers  then  returns  to  the  user  the the actual byte string
  445.           desired.  If the same page is referenced again (by  the  same  or
  446.           another  user)  while  it  is still in a core buffer, no disk I/O
  447.           takes place.
  448.  
  449.           It is important to note that UNIX pages data from the file system
  450.           into  and out of system buffers using a "least recently used" re-
  451.           placement algorithm.  In this  way  the  entire  file  system  is
  452.           managed as a large virtual store.
  453.  
  454.           In part because the INGRES designers believe  that  a  data  base
  455.           system  should  appear  as a user job to UNIX and in part because
  456.           they believe that the operating system should deal with all space
  457.           management  issues for the mix of jobs being run, INGRES contains
  458.           NO facilities to do its own memory management.
  459.  
  460.           Each file in UNIX can be granted by its owner any combination  of
  461.           the following protection clauses:
  462.  
  463.            a) owner read
  464.            b) owner write
  465.            c) non owner read
  466.            d) non owner write
  467.            e) execute
  468.            f) special execute
  469.  
  470.           When INGRES is initially generated, a UNIX user named  INGRES  is
  471.           created.   All  data files managed by the INGRES system are owned
  472.           by this "super-user" and have  their  protection  status  set  to
  473.           "owner  read,  owner write, no other access".  Consequently, only
  474.           the INGRES super-user can  directly  tamper  with  INGRES  files.
  475.           (The  protection  system is currently being altered to optionally
  476.           require the consent of the data base administrator before  unres-
  477.           tricted access by the super-user is allowed.)
  478.  
  479.           The INGRES object code is stored in files whose protection status
  480.           is  set  to  "special execute, no other access".  When a user in-
  481.           vokes the INGRES system (by executing  command  a)  above),  UNIX
  482.           creates the INGRES processes operating temporarily with a user-id
  483.           of INGRES.  When a user exits from  INGRES  these  processes  are
  484.           destroyed  and  the  user  is  restored to operating with his own
  485.           user-id.
  486.  
  487.           Using this mechanism, the only way a user may  access  an  INGRES
  488.           data  base is to execute INGRES object code.  This "safety latch"
  489.           effectively isolates users from tampering  directly  with  INGRES
  490.           data.
  491.  
  492.           b) The UNIX process structure
  493.  
  494.           A process in  UNIX is an address space which is associated with a
  495.           user-id and is the unit of work  scheduled by the UNIX scheduler.
  496.       Processes may "fork" subprocesses; consequently, a parent process
  497.           can be the root of a process subtree.  Furthe more, a process can
  498.           request  that UNIX execute  a file in a descendant process.  Such
  499.           processes  may communicate  with each other via an  inter-process
  500.           communication facility called "pipes".  A pipe may be declared as
  501.           a one direction communication link  which  is written into by one
  502.           process and read by a second one.  UNIX maintains synchronization
  503.           of pipes so no  messages  are lost.  Each process has a "standard
  504.           input device" and a "standard  output device".  These are usually
  505.           the user's terminal but may be redirected by the user to be files,
  506.       pipes to other processes, or other devices.
  507.  
  508.           Lastly UNIX provides  a  facility  for  processes  executing  re-
  509.           entrant  code  to  share  procedure segments if possible.  INGRES
  510.           takes advantage of this facility so the core  space  overhead  of
  511.           multiple concurrent users is only that required by data segments.
  512.  
  513.           We turn in the next section to the  process  structure  in  which
  514.           INGRES runs.
  515.  
  516.  
  517.           2  THE INGRES PROCESS STRUCTURE
  518.  
  519.           INGRES can be invoked in two ways:  First, it can be directly in-
  520.           voked from UNIX by executing INGRES data-base-name; second it can
  521.           be invoked by executing a program written using the EQUEL precom-
  522.           piler.   We  discuss each in turn and then comment briefly on why
  523.           two mechanisms exist.
  524.  
  525.           2.1 INVOCATION FROM UNIX
  526.  
  527.           Issuing INGRES as a UNIX command  causes  the  process  structure
  528.           shown in Figure 1 to be created.
  529.  
  530.           ________     ________     ________     ________     ________
  531.           |      |     |      |  A  |      |  B  |      |  C  |      |
  532.           | user |---->|      |---->|      |---->|      |---->|      |
  533.           | term-|     |      |     |      |     |      |     |      |
  534.           | inal |<----|      |<----|      |<----|      |<----|      |
  535.           |      |     |      |  F  |      |  E  |      |  D  |      |
  536.           ________     ________     ________     ________     ________
  537.  
  538.                        process      process      process      process
  539.                           1            2            3            4
  540.  
  541.  
  542.                            INGRES Process Structure
  543.  
  544.                                 Figure 1
  545.  
  546.           Process 1 is an interactive terminal  monitor  which  allows  the
  547.           user  to formulate, print, edit and execute collections of INGRES
  548.           commands.  It maintains a workspace with which the user interacts
  549.           until he is satisfied with his interaction.  The contents of this
  550.           workspace are passed down pipe A as a string of ASCII  characters
  551.           when execution is desired.
  552.  
  553.           As noted above, UNIX allows a user to alter  the  standard  input
  554.           and  output  devices  for his processes when executing a command.
  555.           As a result the invoker of INGRES may direct the terminal monitor
  556.           to  take input from a user file (in which case he runs a "canned"
  557.           collection of interactions) and direct output to  another  device
  558.           (such as the line printer) or a file.
  559.  
  560.           The current terminal  monitor  accepts  the  following  commands.
  561.           Anything else is simply appended to the user's workspace.
  562.  
  563.           #  Erase the previous character.  Successive uses of this
  564.              instruction will erase back to, but not beyond, the
  565.              beginning of the current line.
  566.  
  567.           @  Erase the current line.  Successive uses of  this  in-
  568.              struction are ignored.
  569.  
  570.          \r  Erase the entire interaction (reset the workspace).  The
  571.              former contents of the workspace are irretrieveably lost.
  572.  
  573.          \p  Print the current workspace.  Its contents are printed
  574.              on the user's terminal.
  575.  
  576.          \e  Enter the UNIX text editor and begin accepting editor
  577.              commands.  The editor allows sophisticated editing of the
  578.              user's workspace.  This command is executed by simply
  579.              "forking" a subprocess and executing the UNIX editor in it.
  580.  
  581.          \g  Process the current query (go).  The contents of the
  582.              workspace are transmitted to process 2.
  583.  
  584.          \q  Exit from INGRES.
  585.  
  586.           Process 2 contains a lexical analyzer, a parser, query  modifica-
  587.           tion routines for integrity control (and in the future support of
  588.           views and protection) and concurrency control.   When  process  2
  589.           finishes,  it passes a string of tokens to process 3 through pipe
  590.  
  591.           B.  Process 2 is discussed in Section 4.
  592.  
  593.           Process 3 accepts this token string and contains  execution  rou-
  594.           tines for the commands RETRIEVE, REPLACE, DELETE and APPEND.  Any
  595.           update is turned into a RETRIEVE command to isolate tuples to  be
  596.           changed.   Revised  copies  of modified tuples are spooled into a
  597.           special file.  This file is then processed by a "deferred  update
  598.           processor" in process 4 which is discussed in Section 6.
  599.  
  600.           Basically process 3 performs two functions for RETRIEVE commands.
  601.  
  602.           a)  A  multivariable  query  is DECOMPOSED into a sequence of in-
  603.           teractions involving only a single variable.  b) A  one  variable
  604.           query is executed by a one variable query processor (OVQP).  OVQP
  605.           in turn performs its function  by  making  calls  on  the  access
  606.           methods.  These two functions are discussed in Section 5; the ac-
  607.           cess method are indicated in Section 3.
  608.  
  609.           In process  4  resides  all  code  to  support  utility  commands
  610.           (CREATE,  DESTROY, INDEX, etc.).  Process 3 simply passes to pro-
  611.           cess 4 any commands which process 4 will execute.  Process  4  is
  612.           organized  as a collection of overlays which accomplish the vari-
  613.           ous functions.  The structure of this process will  be  discussed
  614.           in Section 6.
  615.  
  616.           Error messages are passed back through pipes D, E and F  to  pro-
  617.           cess  1  which  returns them to the user. If the command is a RE-
  618.           TRIEVE with no result relation specified, process 3 returns qual-
  619.           ifying tuples in a stylized format directly to the "standard out-
  620.           put device" of process 1.  Unless redirected, this is the  user's
  621.           terminal.
  622.  
  623.           We now turn to the operation of INGRES when invoked by code  from
  624.           the precompiler.
  625.  
  626.           2.2  EQUEL
  627.  
  628.           Although QUEL  alone  provides  the  flexibility  for  most  data
  629.           management  requirements,  there  are many applications which re-
  630.           quire a customized user interface in place of the QUEL  language.
  631.           For this as well as other reasons, it is often useful to have the
  632.           flexibility of a general purpose programming language in addition
  633.           to  the  data  base  facilities  of  QUEL.   To  this  end, a new
  634.           language, EQUEL (Embedded QUEL), has been implemented which  con-
  635.           sists  of  QUEL  embedded  in  the  general  purpose  programming
  636.           language "C".
  637.  
  638.           In this section we describe the EQUEL language and  indicate  how
  639.           it operates in the INGRES environment.
  640.  
  641.           In the design of EQUEL, the following goals were set:
  642.  
  643.             1) The new language must have the full capabilities of both "C"
  644.                and QUEL.
  645.  
  646.             2) The C program should have the capability for processing each
  647.                tuple  individually  which  satisfies the qualification in a
  648.                QUEL RETRIEVE statement.  (this is the "piped" return facil-
  649.                ity described in Data Language/ALPHA [CODD71]).
  650.  
  651.             3) The implementation should make as much use  as  possible  of
  652.                the  existing C and QUEL language processors. (The implemen-
  653.                tation cost of EQUEL should be small).
  654.  
  655.           With these goals in mind, EQUEL was defined as follows:
  656.  
  657.             1) Any C language statement is a valid EQUEL statement.
  658.  
  659.             2) Any QUEL statement (or INGRES utility command)  is  a  valid
  660.                EQUEL  statement  as  long  as  it is prefixed by two number
  661.                signs ("##").
  662.  
  663.             3) C program variables may be used in QUEL statements in  place
  664.                of  relation  names,  domain names, target list elements, or
  665.                domain values.  The declaration statements  of  C  variables
  666.                used  in  this manner must also be prefixed by double number
  667.                signs.
  668.  
  669.             4) RETRIEVE statements without a result relation have the  form
  670.  
  671.                        RETRIEVE (Target-list) [WHERE Qualification] C-Block
  672.  
  673.                which results in the C-Block being executed  once  for  each
  674.                qualifying tuple.
  675.  
  676.           Two short examples illustrate EQUEL syntax.
  677.  
  678.           Example 2.1  The following section of  code  implements  a  small
  679.           front  end  to INGRES which performs only one query.  It reads in
  680.           the name of an employee and prints out the employee's salary in a
  681.  
  682.           suitable  format.   It  continues to do this as long as there are
  683.           more names to be read in.  The functions READ and PRINT  are  as-
  684.           sumed to have the obvious meaning.
  685.  
  686.               main()
  687.               {
  688.               ## char NAME[20];
  689.               ## int SAL;
  690.               while (READ(NAME))
  691.                       {
  692.               ##      RANGE OF X IS EMP
  693.               ##      RETRIEVE (SAL = X.SALARY)
  694.               ##      WHERE X.NAME = NAME
  695.                               {
  696.                               PRINT("The salary of ",NAME," is ",SAL);
  697.                               }
  698.                       }
  699.               }
  700.  
  701.               In this example the C-variable NAME is used in the qualifica-
  702.               tion of the QUEL statement and for each qualifying tuple, the
  703.               C-variable SAL is set to the appropriate value and  then  the
  704.               Print  statement  is  executed.   (note: in C "{" and "}" are
  705.               equivalent to BEGIN and END in ALGOL).
  706.  
  707.           Example 2.2  Read in a relation name and two domain names.   Then
  708.           for  each of a collection of values which the second domain is to
  709.           assume, do some processing on all values which the  first  domain
  710.           assumes.   (We  assume  the  functions READ and PROCESS exist and
  711.           have the obvious meanings.) A more elaborate version of this pro-
  712.           gram could serve as a simple report generator.
  713.  
  714.               ## int VALUE;
  715.               ## char RELNAME[13], DOMNAME[13], DOMVAL[80];
  716.               ## char DOMNAME_2[13];
  717.               READ(RELNAME);
  718.               READ(DOMNAME);
  719.               READ(DOMNAME_2);
  720.               ## RANGE OF X IS RELNAME
  721.               while (READ(DOMVAL))
  722.                       {
  723.               ##      RETRIEVE (VALUE = X.DOMNAME)
  724.               ##          WHERE X.DOMNAME_2 = DOMVAL
  725.                               {
  726.                               PROCESS(VALUE);
  727.                               }
  728.                       }
  729.  
  730.           Any RANGE declaration (in this case the one for X) is assumed  by
  731.           INGRES  to hold until redefined.  Hence, only one RANGE statement
  732.           is required regardless of the number of times the RETRIEVE state-
  733.           ment is executed.
  734.  
  735.           In order to implement  EQUEL,  a  translator  (pre-compiler)  was
  736.           written  which  converts  an EQUEL program into a valid C-program
  737.           with QUEL statements converted to appropriate C-code and calls to
  738.           INGRES.   The  resulting C-program is then compiled by the normal
  739.           C-compiler producing an executable  module.   Moreover,  when  an
  740.           EQUEL  program  is  run, the executable module produced by the C-
  741.           compiler is used as the front end process in  place  of  the  in-
  742.           teractive terminal monitor as noted in Figure 2.
  743.  
  744.                        ________     ________     ________     ________
  745.                        |      |  A  |      |  B  |      |  C  |      |
  746.                        |      |---->|      |---->|      |---->|      |
  747.                        |      |     |      |     |      |     |      |
  748.                        |      |<----|      |<----|      |<----|      |
  749.                        |      |  F  |      |  E  |      |  D  |      |
  750.                        ________     ________     ________     ________
  751.  
  752.                           C         process      process      process
  753.                        program         2            3            4
  754.  
  755.  
  756.                                    The Forked Process Structure
  757.  
  758.                                           Figure 2
  759.  
  760.  
  761.  
  762.           During execution of the front-end  program,  data  base  requests
  763.           (QUEL  statements in the EQUEL program) are passed through pipe A
  764.           and processed by INGRES.  If tuples must be returned for tuple at
  765.           a  time processing, then they are returned through a special data
  766.           pipe set up between process 3 and the  C  program.   A  condition
  767.           code  is  also returned through pipe F to indicate success or the
  768.           type of error encountered.
  769.  
  770.           Consequently, the EQUEL translator  must  perform  the  following
  771.           five functions:
  772.  
  773.                1) insert system calls to "spawn" at run  time  the  process
  774.                structure shown in Figure 2.
  775.  
  776.                2) note C-variable declarations prefaced by ## as legal  for
  777.                inclusion in INGRES commands.
  778.  
  779.                3) process other lines prefaced by ##.  These are parsed  to
  780.                isolate C-variables.  In adddition, C statements are insert-
  781.                ed to write the line down pipe A in ASCII  format,  modified
  782.                so that values are substituted for any C-variables.  The ra-
  783.                tionale for not completely parsing a QUEL statement in EQUEL
  784.                is given in [ALLM76].
  785.  
  786.                4) insert C statements to read pipe F for completion  infor-
  787.                mation  and call the procedure IIerror.  The user may define
  788.                IIerror himself or have EQUEL  include  a  standard  version
  789.                which  prints  the error message (for abnormal terminations)
  790.                and continues.
  791.  
  792.                5) If data is to be returned through the data pipe (by a RE-
  793.                TRIEVE with no result relation specified), EQUEL must also:
  794.  
  795.                     a) insert C statements to read the data pipe for a  tu-
  796.                     ple formatted as type/value pairs.
  797.  
  798.                     b) insert C statements to  substitute  values  into  C-
  799.                     variables  declared  in the target list.  If necessary,
  800.                     values are converted to the types of  the  declared  C-
  801.                     variables.
  802.  
  803.                     c) insert C statements to pass control to  the  C-block
  804.                     following the RETRIEVE.
  805.  
  806.                     d) insert C statements following the block to return to
  807.                     step a) if there are more tuples.
  808.  
  809.           2.3 COMMENTS ON THE PROCESS STRUCTURE
  810.  
  811.           The process structure shown in Figures 1 and 2 is the fourth dif-
  812.           ferent  process  structure implemented.  The following considera-
  813.           tions suggested this final choice:
  814.  
  815.           a) Simple control flow.  Previous process structures had  a  more
  816.           complex interconnection of processes which made debugging harder.
  817.  
  818.           b) Commands are passed to the right only.  Process 3  must  issue
  819.           commands to various overlays in process 4 to execute interactions
  820.           as discussed in Section 5.  Hence, process 3 must be to the  left
  821.           of process 4.
  822.  
  823.           c) The utility commands are expected to be called relatively  in-
  824.           frequently  compared  to the activity in process 2 and 3.  Hence,
  825.           it appears appropriate to overlay little used code  in  a  single
  826.           process.   The alternative is to create additional processes (and
  827.           pipes) which are quiescent most of the time.  This would  require
  828.           added space in UNIX core tables for no particular advantage.
  829.  
  830.           d) The first 3 processes are used frequently. Overlaying code  in
  831.           these  processes  was  tried in a previous version and slowed the
  832.           system considerably.
  833.  
  834.           e) To run on an 11/40, the 64K address space limitation  must  be
  835.           adhered  to.  Processes 2 and 3 are nearly their maximum size and
  836.           hence cannot be combined. (For 11/45 and 11/70  versions  we  may
  837.           experiment with such a combination.)
  838.  
  839.           f) The C program which replaces the terminal monitor as  a  front
  840.           end  must  run  with  a user-id different from that of INGRES for
  841.           protection reasons. (Otherwise it could tamper directly with data
  842.           managed  by  INGRES.)  Hence,  either it must be overlayed into a
  843.           process or run in its own process.  For efficiency  and  conveni-
  844.           ence, the latter was chosen.
  845.  
  846.           g) The interactive terminal monitor could have been written  (al-
  847.           beit  clumsily) in EQUEL.  Such a strategy would have avoided the
  848.           existence of two process structures  which  differ  only  by  the
  849.           treatment  of  the data pipe.  This was not done because response
  850.           time would have degraded and because EQUEL does  type  conversion
  851.           to predefined types.  This feature would unnecessarily complicate
  852.           the terminal monitor.
  853.  
  854.           h) The processes are all synchronized (i.e. each waits for an er-
  855.           ror  return  from the next process to the right before continuing
  856.           to accept input from the process to the left.  This is  done  be-
  857.           cause  it  simplifies  the flow of control.  Moreover in many in-
  858.           stances the various processes MUST be synchronized.  Future  ver-
  859.           sions  of  INGRES may attempt to exploit parallelism where possi-
  860.           ble.
  861.  
  862.  
  863.           3  DATA STRUCTURES AND ACCESS METHODS
  864.  
  865.           We begin this section with a discussion of the files that  INGRES
  866.           manipulates and their contents.  Then we sketch the language used
  867.           to access all non directory files.  Finally,  the  five  possible
  868.           file formats are indicated.
  869.  
  870.           3.1 THE INGRES FILE STRUCTURE
  871.  
  872.           Figure 3 indicates the subtree  of  the  UNIX  file  system  that
  873.           INGRES manipulates.
  874.  
  875.  
  876.  
  877.                                  The INGRES Subtree
  878.  
  879.  
  880.                                       Figure 3
  881.  
  882.  
  883.  
  884.                               The root of this subtree
  885.           is a directory made for the UNIX user "INGRES".  It has six  des-
  886.           cendant directories.  The AUX directory contains descendant files
  887.           containing tables which control the spawning of  processes  shown
  888.           in  Figures  1  and 2, and an authorization list of users who are
  889.           allowed to create data bases.  Only the INGRES  "super-user"  may
  890.           modify  these  files  (by using the UNIX editor).  BIN and SOURCE
  891.           are directories indicating descendant files of  respectively  ob-
  892.           ject  and  source  code.  TMP contains temporary files containing
  893.           the workspaces used by the interactive terminal monitor.  DOC  is
  894.           the root of a subtree with system documentation and the reference
  895.           manual.  Lastly there is a directory entry in  DATADIR  for  each
  896.           data  base  that exists in INGRES.  These directories contain the
  897.           data base files in a given data base as descendants.
  898.  
  899.           These data base files are of four types:
  900.  
  901.           a)  an administration file.  This contains  the  user-id  of  the
  902.           data base administrator (DBA) and initialization information.
  903.  
  904.           b)  System relations.  These relations have predefined names  and
  905.           are  created  for every data base.  They are owned by the DBA and
  906.           constitute the  system  catalogs.   They  may  be  queried  by  a
  907.           knowledgeable user issuing RETRIEVE statements, however, they may
  908.           be updated only by the INGRES utility commands  (or  directly  by
  909.           the  INGRES  "super-user"  in  an  emergency).   (When protection
  910.           statements are implemented the DBA will be  able  to  selectively
  911.           restrict  RETRIEVE  access  to these relations if he wishes.) The
  912.           form and content of some of these  relations  will  be  presently
  913.           discussed.
  914.  
  915.           c)  DBA relations.  These are relations owned by the DBA and  are
  916.           shared  in that any user may access them.  When protection is im-
  917.           plemented the DBA can "authorize" other users by  inserting  pro-
  918.           tection predicates (which will be in one of the system relations)
  919.           and "deauthorize" them by removing such predicates.
  920.  
  921.           d)  Other relations.  These are relations created by other  users
  922.           (by RETRIEVE into W or CREATE) and are NOT SHARED.
  923.  
  924.           Three comments should be made at this time.
  925.  
  926.           a)  The DBA has the following power  not  available  to  ordinary
  927.           users:
  928.  
  929.                   1) the ability to create shared relations and to  specify
  930.                   access control for them
  931.  
  932.                   2) the ability to run RELKILLER
  933.  
  934.                   3) the ability to destroy any relations in his data  base
  935.                   (except the system catalogs)
  936.  
  937.           This system allows "one level sharing" in that only the  DBA  has
  938.           the  powers  in  a) and he cannot delegate any of these powers to
  939.           others (as in the file systems  of  most  time-sharing  systems).
  940.           This strategy was implemented for three reasons:
  941.  
  942.                   1) The need  for  added  generality  was  not  perceived.
  943.                   Moreover,  added  generality  would  have created tedious
  944.                   problems (such as making revocation of access  privileges
  945.                   non trivial).
  946.  
  947.                   2) It seems appropriate to entrust to the  DBA  the  duty
  948.                   (and  power) to resolve the policy decision which must be
  949.                   made when space is exhausted and some relations  must  be
  950.                   destroyed  (or  archived).  This  policy decision becomes
  951.                   much harder (or impossible) if a data base is not in  the
  952.                   control of one user.
  953.  
  954.                   3) Someone must be entrusted  with  the  policy  decision
  955.                   concerning  which relations to physically store and which
  956.                   to define as "views".  This "data base design" problem is
  957.                   best centralized in a single DBA.
  958.  
  959.           b) Except for the single administration file in  each  data  base
  960.           every  file is treated as a relation.  Storing system catalogs as
  961.           relations has the following advantages:
  962.  
  963.                   1) Code is economized by sharing routines  for  accessing
  964.                   both catalog and data relations.
  965.  
  966.                   2) Since several storage structures are supported for ac-
  967.                   cessing data relations quickly and flexibly under various
  968.                   interaction mixes, these  same  storage  choices  may  be
  969.                   utilized to enhance access to catalog information.
  970.  
  971.                   3) The ability to execute QUEL statements to examine (and
  972.                   patch) system relations where necessary has greatly aided
  973.                   system debugging.
  974.  
  975.           c)  Each relation is stored in a separate file, i.e., no  attempt
  976.           is made to "cluster" tuples from different relations which may be
  977.           accessed together on the same (or a nearby) page.  This  decision
  978.           is based on the following reasoning.
  979.  
  980.                   1) The access methods would be more complicated if  clus-
  981.                   tering were supported.
  982.  
  983.                   2) UNIX has a small (512 byte) page size.   Hence  it  is
  984.                   expected  that  the number of tuples which can be grouped
  985.                   on the same page is small.  Moreover, logically  adjacent
  986.                   pages in a UNIX file are NOT NECESSARILY physically adja-
  987.                   cent.  Hence clustering tuples on "nearby" pages  has  no
  988.                   meaning  in  UNIX; the next logical page in a file may be
  989.                   further away (in terms of disk arm motion) than a page in
  990.                   a different file.  In keeping with the design decision of
  991.                   NOT modifying UNIX, these considerations were incorporat-
  992.                   ed in the design decision not to support clustering.
  993.  
  994.                   3) Clustering of tuples only makes  sense  if  associated
  995.                   tuples  can  be  linked together using "sets" [CODA71] or
  996.                   "links" [TSIC75].  Incorporating these access paths  into
  997.                   the decomposition scheme would have greatly increased its
  998.                   complexity.
  999.  
  1000.           3.2  SYSTEM CATALOGS
  1001.  
  1002.           We turn now to a discussion of the system  catalogs.  We  discuss
  1003.           two  relations in detail and indicate briefly the contents of the
  1004.           others.
  1005.  
  1006.           The RELATION relation contains one tuple for  every  relation  in
  1007.           the  data base (including all the system relations.)  The domains
  1008.           of this relation are:
  1009.  
  1010.                   relid           the name of the relation
  1011.  
  1012.                   owner           the UNIX user-id of the relation owner;
  1013.                                   when appended to relid it produces a
  1014.                                   unique file name for storing the rela-
  1015.                                   tion.
  1016.  
  1017.                   spec            indicates one of 5 possible storage
  1018.                                   schemes or else a special code indicating
  1019.                                   a virtual relation (or "view").
  1020.  
  1021.                   indexd          flag set if secondary index exists for
  1022.                                   this relation.  (This flag and the fol-
  1023.                                   lowing two are present to improve perfor-
  1024.                                   mance by avoiding catalog lookup's when
  1025.                                   possible during query modification and
  1026.                                   one variable query processing.)
  1027.  
  1028.                   protect         flag set if this relation has protection
  1029.                                   predicates.
  1030.  
  1031.                   integ           flag set if there are integrity con-
  1032.                                   straints.
  1033.  
  1034.                   save            scheduled life time of relation.
  1035.  
  1036.                   tuples          number of tuples in relation.
  1037.  
  1038.                   atts            number of domains in relation.
  1039.  
  1040.                   width           width (in bytes) of a tuple.
  1041.  
  1042.                   prim            number of primary file pages for this re-
  1043.                                   lation.
  1044.  
  1045.  
  1046.           The ATTRIBUTE catalog contains information relating to individual
  1047.           domains  of  relations.   Tuples of the ATTRIBUTE catalog contain
  1048.           the following items for each domain of every relation in the data
  1049.           base:
  1050.  
  1051.  
  1052.                   relid           name of relation in which attribute ap-
  1053.                                   pears
  1054.  
  1055.                   owner           relation owner
  1056.  
  1057.                   domain-name     domain name
  1058.  
  1059.                   domainno        domain number (position) in relation.  In
  1060.                                   processing interactions INGRES uses this
  1061.                                   number to reference this domain.
  1062.  
  1063.                   offset          offset in bytes from beginning of tuple
  1064.                                   to beginning of domain.
  1065.  
  1066.                   type            data type of domain (integer, floating
  1067.                                   point or character string).
  1068.  
  1069.                   length          length (in bytes) of domain;
  1070.  
  1071.                   keyno           if this domain is part of a key, then
  1072.                                   "keyno" indicates the ordering of this
  1073.                                   domain within the key.
  1074.  
  1075.  
  1076.           These two catalogs together provide information about the  struc-
  1077.           ture  and  content  of  each  relation in the data base. No doubt
  1078.           items will continue to be added or deleted as the  system  under-
  1079.           goes  further  development.  The first planned extensions are the
  1080.           minimum and maximum values assumed by the domain.  These will  be
  1081.           used   by   a   more  sophisticated  decomposition  scheme  being
  1082.           developed, which is discussed briefly in the next section and  in
  1083.           detail  in [WONG76].  The representation of the catalogs as rela-
  1084.           tions has allowed this restructuring to occur very easily.
  1085.  
  1086.           Several other system relations exist which provide auxiliary  in-
  1087.           formation  about  relations.   The INDEX catalog contains a tuple
  1088.           for every secondary index in the data base.  Since secondary  in-
  1089.           dices  are  themselves relations they are independently cataloged
  1090.           in the RELATION and ATTRIBUTE relations.  However, the INDEX  ca-
  1091.           talog provides the association between a primary relation and the
  1092.           secondary indices for it including which domains of  the  primary
  1093.           relation are in the index.
  1094.  
  1095.           The PROTECTION and INTEGRITY catalogs  contain  respectively  the
  1096.           protection and integrity predicates for each relation in the data
  1097.           base.  These predicates are stored in a partially processed  form
  1098.           as  character  strings.  (This mechanism exists for INTEGRITY and
  1099.           will be implemented in the same way for PROTECTION.) The VIEW ca-
  1100.           talog  will  contain, for each virtual relation, a partially pro-
  1101.           cessed QUEL-like description which can be used to  construct  the
  1102.           view  from  its  component  physical relations.  The use of these
  1103.           last three catalogs will be described  in  Section  4.   The  ex-
  1104.           istence of any of this auxiliary information for a given relation
  1105.           is signalled by the appropriate flag(s) in the RELATION catalog.
  1106.  
  1107.  
  1108.           Yet another set of system relations are those used by the  graph-
  1109.           ics  sub-system  to  catalog and process maps, which (like every-
  1110.           thing else) are stored as relations in the data base.  This topic
  1111.           has been discussed separately in [GO75].
  1112.  
  1113.           3.3 ACCESS METHODS INTERFACE (AMI).
  1114.  
  1115.           We will now discuss in more detail the AMI which handles all  ac-
  1116.           tual  accessing  of data from relations.  The AMI language is im-
  1117.           plemented as a set of functions whose calling conventions are in-
  1118.           dicated below.
  1119.  
  1120.           Each access method must do two things to  support  the  following
  1121.           calls.   First it must provide SOME linear ordering of the tuples
  1122.           in a relation so that the concept of "next  tuple"  is  well  de-
  1123.           fined.   Second  it  must  assign  to each tuple a tuple-id (TID)
  1124.           which uniquely identifies a tuple.
  1125.  
  1126.           The nine implemented calls are as follows:
  1127.  
  1128.           a)  openr(descriptor, mode, relation_name)
  1129.  
  1130.           Before a relation may be accessed  it  must  be  "opened".   This
  1131.           function  opens  the  UNIX  file  for the relation and fills in a
  1132.           "descriptor" with information about the relation from  the  RELA-
  1133.           TION  and  ATTRIBUTE catalogs.  The descriptor, which must be de-
  1134.           clared in the calling program, is used in subsequent calls on AMI
  1135.           routines  as  an input parameter to indicate what relation is in-
  1136.           volved.  Consequently, the AMI data accessing routines  need  not
  1137.           themselves check the system catalogs for the description of a re-
  1138.           lation.  "Mode" specifies whether the relation  is  being  opened
  1139.           for update or for retrieval only.
  1140.  
  1141.           b)  get(descriptor, tid, limit_tid, tuple, next_flag)
  1142.  
  1143.           This function retrieves into 'tuple' a single tuple from the  re-
  1144.           lation  indicated  by  'descriptor'.   There are two modes of re-
  1145.           trieval, "scan" and "direct".  In "scan" mode "get"  is  intended
  1146.           to  be  called successively to retrieve all tuples within a range
  1147.           of tuple-id's. An initial value of 'tid' sets the low end of  the
  1148.           range desired and 'limit_tid' sets the high end.  Each time "get"
  1149.           is called with 'next_flag' = TRUE, the tuple  following  for  the
  1150.           next call.  Reaching 'limit_tid' is indicated by a special return
  1151.           code.  The initial setting of 'tid' and 'limit_tid'  is  done  by
  1152.           the  "find" function.  In "direct" mode ('next_flag' = FALSE) the
  1153.           function retrieves the tuple with tuple-id = 'tid'.
  1154.  
  1155.           c)  find(descriptor, key, tid, match_mode)
  1156.  
  1157.           "Find" places in 'tid' the tuple-id at the low or high end of the
  1158.           range of tuples which match the key value supplied.  The matching
  1159.           condition to be applied depends on 'match-mode'.
  1160.  
  1161.           If the relation does not have a keyed storage structure or if the
  1162.           key  supplied does not correspond to the correct key domains, the
  1163.           'tid' returned will be as if no key were supplied.  The objective
  1164.           of  "find"  is  to restrict the scan of a relation by eliminating
  1165.           from consideration those tuples known from their placement in the
  1166.           relation  not  to  satisfy  the  matching condition with the key.
  1167.           Calls to "find" occur in pairs, one to set the low end of a scan,
  1168.           the  other  for the high end, and the two tuple-id's obtained are
  1169.           used in subsequent calls on "get".
  1170.  
  1171.           Two functions are available for determining  the  access  charac-
  1172.           teristics  of the storage structure of a primary data relation or
  1173.           secondary index, respectively.
  1174.  
  1175.           d)  paramd(descriptor, access_characteristics_structure)
  1176.           e)  parami(descriptor, access_characteristics_structure)
  1177.  
  1178.           These functions fill  in  the  'access_characteristics_structure'
  1179.           with  information  regarding  the  type  of key which may be con-
  1180.           structed to optimize access to the given relation.  This includes
  1181.           whether exact key values or ranges of key values can be used, and
  1182.           whether a partially specified key may be used.  This will  deter-
  1183.           mine  the  'match-mode' used in a subsequent call to "find".  The
  1184.           ordering of domains in the key is also  indicated.   These  func-
  1185.           tions  relieve optimization routines executed during the process-
  1186.           ing of an interaction of the need to know directly about specific
  1187.           storage structures.
  1188.  
  1189.           Other AMI functions provide a facility for updating relations.
  1190.  
  1191.           f)  insert(descriptor, tuple)
  1192.  
  1193.           The tuple is added to the relation in  its "proper" place accord-
  1194.           ing to its key value and the storage mode of the relation.
  1195.  
  1196.           g)  replace(descriptor, tid, new_tuple)
  1197.           h)  delete(descriptor, tid)
  1198.  
  1199.           The tuple indicated by 'tid' is either replaced by new values  or
  1200.           deleted  from  the  relation altogether.  The tuple-id of the af-
  1201.           fected tuple will have been obtained by a previous "get".
  1202.  
  1203.           Finally, when all access to a relation is  complete  it  must  be
  1204.           closed:
  1205.  
  1206.           i)  closer(descriptor)
  1207.  
  1208.           This closes the relation's UNIX file and rewrites the information
  1209.           in the descriptor back into the system catalogs if there has been
  1210.           any change.
  1211.  
  1212.           3.4 STORAGE STRUCTURES AVAILABLE.
  1213.  
  1214.           We will now describe the five storage structures currently avail-
  1215.           able in INGRES.  Four of the schemes are keyed, i.e., the storage
  1216.           location of a tuple within the file is a function of the value of
  1217.           the  tuple's  key  domains.   These schemes allow rapid access to
  1218.           specific portions of a relation when key values are supplied. The
  1219.           remaining non-keyed scheme stores tuples in the file independent-
  1220.           ly of their values and provides a low-overhead storage structure,
  1221.           especially  attractive  when the entire relation must be accessed
  1222.           anyway.
  1223.  
  1224.           The non-keyed storage structure in INGRES is a  randomly  ordered
  1225.           sequential  file.   Fixed-length tuples are simply placed sequen-
  1226.           tially in the file in the order supplied.  New  tuples  added  to
  1227.           the  relation  are  merely  appended  to the end of the file. The
  1228.           unique tuple-identifier for each tuple is its byte-offset  within
  1229.           the file.  This mode is intended mainly for
  1230.  
  1231.           a) very small relations, for which the overhead of other  schemes
  1232.           is unwarranted
  1233.  
  1234.           b) transitional storage of data being moved into or  out  of  the
  1235.           system by COPY;
  1236.  
  1237.           c) certain temporary relations created  as  intermediate  results
  1238.           during query processing.
  1239.  
  1240.           In the remaining schemes, the key-value of a tuple determines the
  1241.           page  of  the file on which the tuple will be placed. The schemes
  1242.           share a common "page-structure" for managing tuples on file pages
  1243.           as shown in Figure 4.
  1244.  
  1245.  
  1246.  
  1247.  
  1248.  
  1249.  
  1250.  
  1251.  
  1252.  
  1253.  
  1254.  
  1255.  
  1256.  
  1257.  
  1258.  
  1259.  
  1260.                       Page Layout for Keyed Storage Structures
  1261.  
  1262.                                       Figure 4
  1263.  
  1264.  
  1265.           A tuple must fit entirely on a single page.  Its unique  identif-
  1266.           ier  (TID) consists of a page number (the ordering of its page in
  1267.           the UNIX file) plus a "line number" indicating  its  position  on
  1268.           the page.  A "line table", which grows upwards from the bottom of
  1269.           the page, contains as an entry for each tuple, a pointer  to  the
  1270.           beginning  of  the  tuple.  In this way a page can be reorganized
  1271.           without affecting TID's.
  1272.  
  1273.           Initially the file will contain all its tuples  on  a  number  of
  1274.           "primary"  pages.   If  the  relation grows and these pages fill,
  1275.           "overflow" pages are allocated and chained  by  pointers  to  the
  1276.           primary  pages  with which they are associated.  Within a chained
  1277.           group of pages no special ordering of tuples is maintained.  Thus
  1278.           in a keyed access which locates a particular primary page, tuples
  1279.           matching the key may be on any page in the chain.
  1280.  
  1281.           As discussed in [HELD75b] two modes of key-to-address transforma-
  1282.           tion  are  used -- randomizing and order preserving.  In a "hash"
  1283.           file tuples are distributed randomly throughout the primary pages
  1284.           of  the file according to a hashing function on a key.  This mode
  1285.           is well suited for situations in which access  is  to  be  condi-
  1286.           tioned on a specific key value.
  1287.  
  1288.           As an order-preserving mode,  a  scheme  similar  to  IBM's  ISAM
  1289.           [IBM66]  is used.  The relation is sorted to produce the ordering
  1290.           on a particular key.  A multi-level directory  is  created  which
  1291.           records  the high key on each primary page.  The directory, which
  1292.           is static, resides on several pages within the file itself,  fol-
  1293.           lowing  the primary pages.  A primary page and its overflow pages
  1294.           are not maintained in sort order.  This decision is discussed  in
  1295.           the  section  on  concurrency.  The "ISAM-like" mode is useful in
  1296.           cases where the key value is likely to be  specified  as  falling
  1297.           within  a  range  of values, since a near ordering of the keys is
  1298.           preserved.  The index compression scheme discussed  in  [HELD75b]
  1299.           is currently under implementation.
  1300.  
  1301.           In the above mentioned  keyed  modes,  fixed  length  tuples  are
  1302.           stored.   In  addition,  both  schemes can be used in conjunction
  1303.           with data compression techniques  [GOTT75]  in  cases  where  in-
  1304.           creased  storage utilization outweighs the added cost of encoding
  1305.           and decoding  data  during  access.  These  modes  are  known  as
  1306.           "compressed hash" and "compressed ISAM".
  1307.  
  1308.           The current compression scheme suppresses blanks and portions  of
  1309.           a tuple which match the preceding tuple.  This compression is ap-
  1310.           plied to each page independently.  Other schemes are being exper-
  1311.           imented with.
  1312.  
  1313.           3.5  ADDITION OF NEW ACCESS METHODS
  1314.  
  1315.           One of the goals of the AMI design was to insulate  higher  level
  1316.           software  from  the  actual functioning of the access methods and
  1317.           thereby to make it easy to add different ones.
  1318.  
  1319.           In order to add a new access method one need only extend the  AMI
  1320.           routines to handle the new case.  If the new method uses the same
  1321.           page layout and TID scheme, only find, parami, and paramd need to
  1322.           be extended.  Otherwise new procedures to perform these functions
  1323.           must be supplied for use by get, insert, replace and delete.
  1324.  
  1325.  
  1326.           4  THE STRUCTURE OF PROCESS 2
  1327.  
  1328.           Process 2 contains code to perform four main functions
  1329.  
  1330.           a)  a lexical analyzer
  1331.           b)  a parser (written in YACC [JOHN74])
  1332.           c)  query modification routines to support protection, views  and
  1333.           integrity control
  1334.           d)  concurrency control
  1335.  
  1336.           These are discussed in turn
  1337.  
  1338.           4.1  LEXICAL ANALYSIS AND PARSING
  1339.  
  1340.           The lexical analysis and parsing phases of INGRES have  been  or-
  1341.           ganized  around  the  YACC translator writing system available in
  1342.           UNIX [JOHN74].  YACC takes as input a description  of  a  grammar
  1343.           consisting of BNF-like parsing rules (productions) and precedence
  1344.           rules, plus action statements associated  with  each  production.
  1345.           It  produces  a  set of tables to be interpreted by a parse table
  1346.           interpreter  which  is  combined  with  locally-supplied  lexical
  1347.           analysis and parsing action routines to produce a complete trans-
  1348.           lator.
  1349.  
  1350.           The interpreter uses a bottom-up  LR(1)  parsing  approach.   The
  1351.           lexical  analyzer is called to obtain successive symbols from the
  1352.           input stream as the interpreter attempts to match the input  with
  1353.           productions  in  the  grammar.  When a production is matched YACC
  1354.           performs a reduction and executes the action statement associated
  1355.           with  the  production.   YACC has a mechanism for recovering from
  1356.           errors to continue parsing input in its entirety.
  1357.  
  1358.           While the YACC  parse  table  interpreter  checks  the  syntactic
  1359.           correctness  of  the  input commands, the action statements check
  1360.           for sementic consistency and correctness and prepare the commands
  1361.           for  further  processing.   The system catalogs are used to check
  1362.           that relation and domain names, formats, and so on, are specified
  1363.           appropriately.
  1364.  
  1365.           For utility commands a command indicator and the  parameters  for
  1366.           the  command  are  sent directly to process 3 for transmission to
  1367.           process 4.  Section 6 discusses these commands and  their  imple-
  1368.           mentation.
  1369.  
  1370.           For QUEL commands, the input is translated to  a  tree-structured
  1371.           internal  form  which  will be used in the remaining analysis and
  1372.           processing. Moreover, the qualification part is converted to con-
  1373.           junctive  normal  form.   The  parse tree is now ready to undergo
  1374.           what has been termed "query-modification,"  to  be  described  in
  1375.           Section 4.2 and 4.3.
  1376.  
  1377.           4.2  INTEGRITY
  1378.  
  1379.           Query  modification  includes  adding  integrity  and  protection
  1380.           predicates  to the original query and changing references to vir-
  1381.           tual relations into references to the appropriate physical  rela-
  1382.           tions.   At  the  present time only a simple integrity scheme has
  1383.           been implemented.
  1384.  
  1385.           In [STON75]  algorithms  of  several  levels  of  complexity  are
  1386.           presented  for  performing  integrity control on updates.  In the
  1387.           present system only the simplest case, involving single-variable,
  1388.           aggregate-free  integrity assertions, has been implemented and is
  1389.           described in detail in [SCHO75].
  1390.  
  1391.           Briefly, integrity assertions are entered in  the  form  of  QUEL
  1392.           qualification  clauses to be applied to interactions updating the
  1393.           relation over which the variable  in  the  assertion  ranges.   A
  1394.           parse  tree is created for the qualification and a representation
  1395.           of this tree stored in the INTEGRITY catalog together with an in-
  1396.           dication of the relation and specific domains involved.  At query
  1397.           modification time, updates are checked for any possible integrity
  1398.           assertions  on the affected domains.  Relevant assertions are re-
  1399.           trieved, re-built into tree form and grafted onto the update tree
  1400.           so  as  to  AND the assertions with the existing qualification of
  1401.           the interaction.
  1402.  
  1403.           4.3  PROTECTION AND VIEWS
  1404.  
  1405.           Algorithms for the support of views are also given  in  [STON75].
  1406.           Basically  a view is any relation which could be created from ex-
  1407.           isting relations by the use of a RETRIEVE command.  Such view de-
  1408.           finitions  will be treated in a manner somewhat analogous to that
  1409.           used for integrity control.  They will be allowed  in  INGRES  to
  1410.           support  EQUEL programs written for obsolete versions of the data
  1411.           base and for user convenience.
  1412.  
  1413.           Protection will be handled according to the  algorithm  described
  1414.           in [STON74b].  Like integrity control this algorithm involves ad-
  1415.           ding qualifications to the user's interaction.  In the  remainder
  1416.           of  this  section  we distinguish this protection scheme from the
  1417.           one in [CHAM75] and indicate the rationale behind its use.
  1418.  
  1419.           Consider the following two views:
  1420.  
  1421.                     RANGE OF E IS EMPLOYEE
  1422.                     DEFINE RESTRICTION-1 (E.NAME, E. SALARY, E.AGE)
  1423.                     WHERE E.DEPT = "toy"
  1424.  
  1425.                     DEFINE RESTRICTION-2 (E.NAME, E.DEPT, E.SALARY)
  1426.                     WHERE E.AGE < 50
  1427.  
  1428.           and the following two access control statements:
  1429.  
  1430.                     RANGE OF E IS EMPLOYEE
  1431.                     PROTECT (E.NAME, E.SALARY, E.AGE)
  1432.                     WHERE E.DEPT = "toy"
  1433.  
  1434.                     PROTECT (E.NAME, E.SALARY, E.DEPT)
  1435.                     WHERE E.AGE < 50
  1436.  
  1437.           Acess control could be based on views as  suggested  in  [CHAM75]
  1438.           and  a  given user could be authorized to use views RESTRICTION-1
  1439.           and RESTRICTION-2. To find the salary of Harding he could  inter-
  1440.           rogate RESTRICTION-1 as follows:
  1441.  
  1442.                     RANGE OF R IS RESTRICTION-1
  1443.                     RETRIEVE (R.SALARY) WHERE
  1444.                     R.NAME = "Harding"
  1445.  
  1446.           Failing to find Harding in RESTRICTION-1 he would  have  to  then
  1447.           interrogate  RESTRICTION-2.   After  two  queries be would be re-
  1448.           turned the appropriate salary if Harding was under 50 or  in  the
  1449.           toy department.
  1450.  
  1451.           Under the INGRES scheme the user can issue
  1452.  
  1453.                     RANGE OF E IS EMPLOYEE
  1454.                     RETRIEVE (E.SALARY) WHERE
  1455.                     E.NAME = "Harding"
  1456.  
  1457.           which will be modified by the access control algorithm to
  1458.  
  1459.                     RANGE OF E IS EMPLOYEE
  1460.                     RETRIEVE (E.SALARY) WHERE
  1461.                     E.NAME = "Brown"
  1462.                         AND
  1463.                     (E.AGE < 50 OR E.DEPT = "toy")
  1464.  
  1465.           In this way the user need not manually sequence through his views
  1466.           to  obtain  desired  data  but automatically obtains such data if
  1467.           permitted.  Note clearly that the portion of  EMPLOYEE  to  which
  1468.           the  user has access (the union of RESTRICTION-1 and RESTRICTION-
  1469.           2) is not a relation and hence cannot  be  defined  as  a  single
  1470.           view.
  1471.  
  1472.           To summarize, access control restrictions are  handled  automati-
  1473.           cally  by  the INGRES algorithms but must be dealt with by a user
  1474.           sequencing through his views in a "view oriented" access  control
  1475.           scheme.
  1476.  
  1477.           4.4  CONCURRENCY CONTROL
  1478.  
  1479.           In any multiuser system provisions must  be  included  to  ensure
  1480.           that  multiple  concurrent  updates are executed in a manner such
  1481.           that some level of data integrity can be guaranteed.  The follow-
  1482.           ing two (somewhat facetious) updates illustrate the problem.
  1483.  
  1484.                           RANGE OF E is EMPLOYEE
  1485.                   U1      REPLACE E(DEPT = "toy") WHERE
  1486.                                   E.DEPT = "candy"
  1487.  
  1488.                           RANGE OF F is EMPLOYEE
  1489.                   U2      REPLACE F(DEPT = "candy") WHERE
  1490.                                   F.DEPT = "toy"
  1491.  
  1492.                   If U1 and U2 are executed concurrently with no  controls,
  1493.           some  employees  may end up in each department and the particular
  1494.           result may not be repeatable if the data base is  backed  up  and
  1495.           the interactions reexecuted.
  1496.  
  1497.                   The control which must be provided is to  guarantee  that
  1498.           some  data  base  operation  is  "atomic"  (i.e. occurs in such a
  1499.           fashion that it appears instantaneous and  before  or  after  any
  1500.           other  data  base  operation).  This atomic unit will be called a
  1501.           transaction.
  1502.  
  1503.           In INGRES there are three basic choices available for defining  a
  1504.           transaction.
  1505.  
  1506.           a)  something smaller than one INGRES command
  1507.           b)  one INGRES command
  1508.           c)  a collection of INGRES commands.
  1509.  
  1510.           If a) is chosen INGRES could not guarantee that two  concurrently
  1511.           executing  update  commands  gave the same result as if they were
  1512.           executed sequentially (in either  order)  in  one  collection  of
  1513.           INGRES  processes.   In fact the outcome could fail to be repeat-
  1514.           able, as noted in the example above.  This situation  is  clearly
  1515.           undesirable.
  1516.  
  1517.           Option c) is in the opinion of the INGRES designers impossible to
  1518.           support.  The following transaction could be declared in an EQUEL
  1519.           program.
  1520.  
  1521.                BEGIN TRANSACTION
  1522.                     FIRST QUEL UPDATE
  1523.                     SYSTEM CALLS TO CREATE AND DESTROY FILES
  1524.                     SYSTEM CALLS TO FORK  A  SECOND  COLLECTION  OF  INGRES
  1525.                     PROCESSES TO WHICH COMMANDS ARE PASSED
  1526.                     SYSTEM CALLS TO READ FROM A TERMINAL
  1527.                     SYSTEM CALLS TO READ FROM A TAPE
  1528.                     SECOND QUEL UPDATE (whose form depends on previous  two
  1529.                     system calls)
  1530.                END TRANSACTION
  1531.  
  1532.           Suppose T1 is the above transaction and runs concurrently with  a
  1533.           transaction  T2  involving commands of the same form.  The second
  1534.           update of each transaction may well "conflict" with the first up-
  1535.           date  of  the  other.   Note that there is no way to tell apriori
  1536.           that T1 and T2 conflict because the form of the second update  is
  1537.           not known in advance.  Hence a deadlock situation can arise which
  1538.           can only be resolved by aborting one transaction (an  undesirable
  1539.           policy in the eyes of the INGRES designers) or attempting to back
  1540.           out one transaction.  The overhead of backing out through the in-
  1541.           termediate system calls appears prohibitive (if it is possible at
  1542.           all).  Restricting a transaction to have  no  system  calls  (and
  1543.           hence  no  I/0)  cripples  the power of a transaction in order to
  1544.           make deadlock resolution possible  and  was  judged  undesirable.
  1545.           Thus option b) was chosen.
  1546.  
  1547.           The implementation of b) can be achieved  by  physical  locks  on
  1548.           data  items, pages, tuples, domains, relations, etc.  [GRAY75] or
  1549.           by predicate locks [STON74c].  The current implementation  is  by
  1550.           relatively  crude  physical  locks (on domains of a relation) and
  1551.           avoids deadlock by not allowing an interaction to proceed to pro-
  1552.           cess  3  until  it can lock all required resources.  Because of a
  1553.           problem with the current design of certain access  method  calls,
  1554.           all  domains of a relation must currently be locked (i.e. a whole
  1555.           relation is locked) to perform an update.   This  situation  will
  1556.           soon be rectified.
  1557.  
  1558.           The choice of avoiding deadlock rather than detecting and resolv-
  1559.           ing  it  is  made  primarily  for implementation simplicity.  The
  1560.           choice of a crude locking unit reflects a  minicomputer  environ-
  1561.           ment  where core storage for a large lock lable is not available.
  1562.           In the future we plan to experimentally  implement  a  crude  and
  1563.           (thereby  low CPU overhead) version of a predicate locking scheme
  1564.           previously described in [STON74c].  Such an approach may  provide
  1565.           considerable  concurrency at an acceptable overhead in lock table
  1566.           space and CPU time, although such a statement is highly  specula-
  1567.           tive.
  1568.  
  1569.           Once the concurrency processor has assembled locks on all domains
  1570.           needed  by  an interaction, it may proceed to process 3 for unem-
  1571.           cumbered execution.
  1572.  
  1573.           To conclude this section we briefly indicate the reasoning behind
  1574.           not  sorting a page and its overflow pages in the "ISAM-like" ac-
  1575.           cess method.  This topic is also discussed in [HELD75c].
  1576.  
  1577.           Basically, maintenance of the sort order of these pages  may  re-
  1578.           quire  the  access  method to lock more than one page when it in-
  1579.           serts a tuple.  Clearly deadlock might  be  possible  given  con-
  1580.           current  updates  and  locks for physical pages would be required
  1581.           (at least once a more sophisticated predicate locking  scheme  is
  1582.           tried  such  as  [STON74c]).   To avoid both problems these pages
  1583.           remain unsorted and the access method need only be able to  read-
  1584.           modify-write a single page as an atomic operation.  Although such
  1585.           an atomic operation is not currently in UNIX (and not  needed  by
  1586.           the current primitive scheme) it is a minor addition.
  1587.  
  1588.  
  1589.           5  PROCESS 3
  1590.  
  1591.           As noted in Section 2 this process  performs  the  following  two
  1592.           functions which will be discussed in turn:
  1593.  
  1594.           a)  the DECOMPOSITION of queries involving more than one variable
  1595.           into  sequences of one-variable queries.  Partial results are ac-
  1596.           cumulated until the entire query is evaluated.  This  program  is
  1597.           called  DECOMP.   It  also turns any updates into the appropriate
  1598.           queries to isolate qualifying tuples and spools new values into a
  1599.           special file for deferred update.
  1600.  
  1601.           b)  the processing of a single variable queries.  The program  is
  1602.           called the one variable query processor (OVQP).
  1603.  
  1604.           5.1  DECOMP
  1605.  
  1606.           Because INGRES allows interactions which are defined on the cross
  1607.           product of perhaps several relations, efficient execution of this
  1608.           step is of crucial importance in order to search as small a  por-
  1609.           tion  of the appropriate cross product space as possible.  DECOMP
  1610.           uses three techniques in processing  interactions.   We  describe
  1611.           each  technique  then give the actual algorithm implemented.  Fi-
  1612.           nally, we indicate the role of a more sophisticated decomposition
  1613.           scheme under design.
  1614.  
  1615.           a)  Tuple substitution
  1616.  
  1617.           The basic technique used by DECOMP to reduce  a  query  to  fewer
  1618.           variables  is  tuple substitution.  One variable (out of possibly
  1619.           many) in  the  query  is  selected  for  substitution.   The  AMI
  1620.           language  is  used to scan the relation associated with the vari-
  1621.           able one tuple at a time.  For each tuple, the values of  domains
  1622.           in  that relation are substituted into the query.  In the result-
  1623.           ing modified query, all previous references  to  the  substituted
  1624.           variable  have  now  been replaced by values (constants), and the
  1625.           query has thus been reduced to one less variable.  Precomposition
  1626.           is  repeated  (recursively)  on the modified query until only one
  1627.           variable remains, at which point the OVQP is called  to  continue
  1628.           processing.
  1629.  
  1630.           b)  One-Variable Detachment
  1631.  
  1632.           If the qualification Q of the query is of the form
  1633.                              Q1(V1)  AND  Q2(V1,...,Vn)
  1634.           for some tuple variable V1, the following two steps can  be  exe-
  1635.           cuted:
  1636.  
  1637.           1)  Issue the query
  1638.  
  1639.                RETRIEVE INTO W (TL[V1])
  1640.                WHERE Q1[V1]
  1641.  
  1642.           Here TL[V1] are those domains required in the  remainder  of  the
  1643.           query.   Note that this is a one variable query and may be passed
  1644.           directly to OVQP.
  1645.  
  1646.           2)  Replace R1, the relation over which V1 ranges, by  W  in  the
  1647.           range declaration and delete Q1[V1] from Q.
  1648.  
  1649.           The query formed in 1)  is  called  a  "one-variable,  detachable
  1650.           sub-query" (OVDSQ) and the technique for forming and executing it
  1651.           "one-variable detachment" (OVD).  This step  has  the  effect  of
  1652.           reducing  the  size  of the relation over which V1 ranges by res-
  1653.           triction and projection.  Hence, it may reduce the complexity  of
  1654.           the processing to follow.
  1655.  
  1656.           Moreover, the opportunity exists in the process of  creating  new
  1657.           relations through OVD, to choose storage structures (and particu-
  1658.           larly keys) which will prove helpful in further processing.
  1659.  
  1660.           c)  Reformatting
  1661.  
  1662.           When a tuple variable  is  selected  for  substitution,  a  large
  1663.           number  of  queries each with one less variable will be executed.
  1664.           If b) is a possible operation after  the  substitution  for  some
  1665.           remaining  variable,  V1, then the relation over which V1 ranges,
  1666.           R1, can be reformatted to have domains used in Q1(V1) as  a  key.
  1667.           This  will expedite b) each time it is executed during tuple sub-
  1668.           stitution.
  1669.  
  1670.           We can now state the complete decomposition algorithm.
  1671.  
  1672.           a)  If number of variables in query is  0  or  1  call  OVQP  and
  1673.           stop; else go on.
  1674.  
  1675.           b)  Find all variables, {V1,...Vn}, for which the query  contains
  1676.           a one-variable clause.  Perform OVD to create new ranges for each
  1677.           of these variables.  The new relation for each variable,  Vi,  is
  1678.           stored as a hash file with key, Ki, chosen as follows.
  1679.  
  1680.                   1) For each j select from  the  remaining  multi-variable
  1681.                   clauses  in  the  query the collection, C(ij), which have
  1682.                   the form
  1683.                           Vi.di = Vj.dj
  1684.                   where di,dj are domains of Vi and Vj.
  1685.                   2)  Form the key Ki to be the  concatenation  of  domains
  1686.                   di1,di2,...of Vi appearing in clauses in C(ij).
  1687.                   3) If more than one j exists, for which C(ij) is non emp-
  1688.                   ty,  one C(ij) is chosen arbitrarily for forming the key.
  1689.                   If C(ij) is empty for all j, the relation is stored as an
  1690.                   unsorted table.
  1691.  
  1692.           c)  Choose the variable, Vs, with the smallest number  of  tuples
  1693.           as the next one for which to perform tuple substitution.
  1694.  
  1695.           d)  For each tuple variable Vj for which C(js) is non  null,  re-
  1696.           format  the  storage structure of the relation Rj which it ranges
  1697.           over, if necessary, so that the key of Rj is the concatenation of
  1698.           domains  dj1,...  appearing  in C(js). This ensures that when the
  1699.           clauses in C(js) become one-variable after substituting  for  Vs,
  1700.           subsequent calls to OVQP to restrict further the range of Vj will
  1701.           be done as efficiently as possible.
  1702.  
  1703.           e)  Perform the following two steps for all tuples in  the  range
  1704.           of the variable selected in (c):
  1705.  
  1706.                   1) substitute values from tuple into query.
  1707.                   2) call decomposition algorithm recursively on a copy  of
  1708.                   resulting  query  which now has been reduced by one vari-
  1709.                   able.
  1710.  
  1711.           The following comments on the algorithm are appropriate:
  1712.  
  1713.           a)  OVD is almost always assured  of  speeding  processing.   Not
  1714.           only  is  it possible to wisely choose the storage structure of a
  1715.           temporary relation but also the cardinality of this relation  may
  1716.           be  much  less  than the one it replaces as the range for a tuple
  1717.           variable.  It only fails if little or no  reduction  takes  place
  1718.           and reformating is unproductive.
  1719.  
  1720.           It should be noted that a temporary relation  is  created  rather
  1721.           than a list of qualifying tuple-id's.  The basic tradeoff is that
  1722.           OVD must copy qualifying tuples but can remove duplicates created
  1723.           during the projection.  Storing tuple-id's avoids the copy opera-
  1724.           tion at the expense of reaccessing qualifying tuples and  retain-
  1725.           ing duplicates.  It is clear that cases exist where each strategy
  1726.           is superior.  The INGRES designers have  chosen  OVD  because  it
  1727.           does  not appear to offer worse performance than the alternative,
  1728.           allows a more accurate choice of the variable with  the  smallest
  1729.           range in step c) above and results in cleaner code.
  1730.  
  1731.           b)  Tuple substitution is done when necessary on the variable as-
  1732.           sociated with the smallest number of tuples.  This has the effect
  1733.           of reducing the number of eventual calls on OVQP.
  1734.  
  1735.           c)  Reformatting is done (if necessary) with the  knowledge  that
  1736.           it  will  replace  a collection of complete sequential scans of a
  1737.           relation by a collection of limited scans.  This will almost  al-
  1738.           ways reduce processing time.
  1739.  
  1740.           d)  It is believed that  this  algorithm  efficiently  handles  a
  1741.           large  class  of  interactions.  Moreover, the algorithm does not
  1742.           require excessive CPU overhead to perform.  There  are,  however,
  1743.           cases  where a more elaborate algorithm is needed.  The following
  1744.           comment applies to these cases.
  1745.  
  1746.           e)  Suppose that we have two or more  strategies  ST0,  ST1,  ...
  1747.           ,STn,  each  one  being better than the previous one but also re-
  1748.           quiring a greater overhead.  Suppose we begin an  interaction  on
  1749.           ST0  and  run it for an amount of time equal to a fraction of the
  1750.           estimated overhead of ST1.  At the end of that  time,  by  simply
  1751.           counting  the number of tuples of the first substitution variable
  1752.           which have already been processed, we can get an estimate for the
  1753.           total processing time using ST0. If this is significantly greater
  1754.           than the overhead of ST1, then we switch to  ST1.   Otherwise  we
  1755.           stay and complete processing the interaction using ST0.  Obvious-
  1756.           ly, the procedure can be repeated on ST1 to call  ST2  if  neces-
  1757.           sary, and so forth.
  1758.  
  1759.           The algorithm detailed in this section is ST0.  A more  sophisti-
  1760.           cated  algorithm  ST1  is currently under development and is dis-
  1761.           cussed in [WONG76].
  1762.  
  1763.           5.2 ONE VARIABLE QUERY PROCESSOR (OVQP)
  1764.  
  1765.           This program is concerned solely with the efficient accessing  of
  1766.           tuples  from  a  single  relation given a particular one-variable
  1767.           query. The initial portion of this program,  known  as  STRATEGY,
  1768.           determines what key (if any) may be profitably used to access the
  1769.           relation, what the value(s) of that key will be used in calls  to
  1770.           the  AMI  routine  "find",  and  whether the access may be accom-
  1771.           plished directly through the AMI to the storage structure of  the
  1772.           relation itself or if a secondary index on the relation should be
  1773.           used.  If access is to be through a secondary index then STRATEGY
  1774.           must choose which ONE of possibly many indices to use.
  1775.  
  1776.           Then, the tuples  retrieved  according  to  the  access  strategy
  1777.           selected are processed by the SCAN portion of OVQP.  This program
  1778.           evaluates each tuple against the qualification part of the query,
  1779.           creates target list values for qualifying tuples, and disposes of
  1780.           the target list appropriately.
  1781.  
  1782.           Since SCAN is relatively straightforward,  we  discuss  only  the
  1783.           policy decisions made in STRATEGY.
  1784.  
  1785.           First STRATEGY  examines  the  qualification  for  clauses  which
  1786.           specify the value of a domain, i.e. clauses of the form:
  1787.  
  1788.                   V.domain op constant
  1789.  
  1790.           where "op" is one of {=, <, >, <=, >=}.  Such clauses are  termed
  1791.           "simple" clauses and are organized into a list
  1792.  
  1793.           Obviously a non-simple clause may be equivalent to a simple one.
  1794.           For example         E.SALARY/2 = 10000 is equivalent to  E.SALARY
  1795.           = 20000.
  1796.  
  1797.           However, recognizing and converting such clauses requires a  gen-
  1798.           eral  algebraic  symbol manipulator.  This issue has been avoided
  1799.           by ignoring all non-simple clauses.  STRATEGY must now select one
  1800.           of two accessing strategies:
  1801.  
  1802.           a)  issuing two AMI find commands on the  primary  relation  fol-
  1803.           lowed  by  a  sequential  scan of the relation between the limits
  1804.           specified
  1805.  
  1806.           b)  issuing two AMI find commands on some index relation followed
  1807.           by  a  sequential scan of the index between the limits specified.
  1808.           For each tuple retrieved the "pointer" domain is obtained and  is
  1809.           a  tuple-id  of  a  tuple in the primary relation.  This tuple is
  1810.           fetched and examined.
  1811.  
  1812.           Key information about the primary relation is obtained using  the
  1813.           AMI  function  "paramd".   Names of indices are obtained from the
  1814.           index catalog and keying information about  indices  in  obtained
  1815.           with the function "parami".
  1816.  
  1817.           STRATEGY now checks if a simple clause is available to limit  the
  1818.           scan of the primary relation or an index relation.  If a relation
  1819.           is hashed the simple clause must specify equality as the operator
  1820.           in  order  to be useful.  ISAM structures on the other hand allow
  1821.           ranges of values and less than all keys may be specified as  long
  1822.           as the first one is present for structures with combined keys.
  1823.  
  1824.           STRATEGY checks for such a simple clause for a  relation  in  the
  1825.           following order:
  1826.  
  1827.                   a.  hashed primary relation
  1828.                   b.  hashed index
  1829.                   c.  ISAM primary relation
  1830.                   d.  ISAM index
  1831.  
  1832.           The rationale for this ordering is related to the expected number
  1833.           of page accesses required to retrieve a tuple from the source re-
  1834.           lation in each case.
  1835.  
  1836.           In case a) the key value provided locates a desired source  tuple
  1837.           in one access, (ignoring overflows). In case b) the key value lo-
  1838.           cates an appropriate index relation tuple in one  access  but  an
  1839.           additional  access  in required to retrieve the proper source tu-
  1840.           ple.  For the ISAM scheme, the directory must be  examined.   The
  1841.           number  of  accesses  incurred  in  this  look-up  is at least 2.
  1842.           Again, with an index, an additional access  is  required,  making
  1843.           the total at least 3 in case d).
  1844.  
  1845.           6  UTILITIES IN PROCESS 4
  1846.  
  1847.           6.1  IMPLEMENTATION OF UTILITY COMMANDS
  1848.  
  1849.           We have indicated in Section 1 several data base utilities avail-
  1850.           able to users.  We will now briefly describe their implementation
  1851.           and indicate their configuration within the INGRES system.
  1852.  
  1853.           The commands are organized into several overlay programs.   Since
  1854.           an  overlay  may  have  more than one entry point, it can contain
  1855.           more than one  utility  command.   In  fact,  the  utilities  are
  1856.           grouped  where possible to minimize overlaying.  The overlays all
  1857.           contain a common main program known as  the  "controller",  which
  1858.           reads  pipe  C  and  writes completion messages into pipe D.  The
  1859.           processing of a utility command occurs as follows.
  1860.  
  1861.           First, the parser recognizes a utility command in a user interac-
  1862.           tion.   This  name  is  looked  up in the INGRES "process-table",
  1863.           which has an entry for each command name in the  language.   Each
  1864.           entry  has  an "overlay-id" and a "function-id".  The first indi-
  1865.           cates the overlay program containing the command, and, the second
  1866.           indicates the proper entry point within that overlay.
  1867.  
  1868.           These id's are passed down pipe B to process 3  followed  by  the
  1869.           parameters  of  the command specified.  Process 3 determines from
  1870.           the "overlay-id" if the command is a utility command intended for
  1871.           process 4.  If so, the information is simply written on pipe C.
  1872.  
  1873.           At this point,  some  overlay  is  occupying  process  4,  having
  1874.           remained  from  a  previous  command.  Its copy of the controller
  1875.           reads pipe C to obtain the overlay-id.  If  a  different  overlay
  1876.           from  the  present one is indicated, the controller overlays pro-
  1877.           cess 4 and control passes to the controller of the new overlay.
  1878.  
  1879.           Most of the utilities update or read the system  relations  using
  1880.           AMI  calls.   MODIFY contains a sort routine which puts tuples in
  1881.           collating sequence according to the concatenation of the  desired
  1882.           keys  (which  need not be of the same data type).  Pages are ini-
  1883.           tially loaded to approximately 80% of capacity.  The sort routine
  1884.           is  a  recursive  N-way  merge-sort  where N is maximum number of
  1885.           files process 4 can have open at once (currently 8).   The  index
  1886.           building occurs in an obvious way.  To convert to hash structures
  1887.           MODIFY must specify the number of primary pages to be  allocated.
  1888.           This  parameter is used by the AMI in its hash scheme (which is a
  1889.           standard modulo division method).  This is  done  by  a  rule  of
  1890.           thumb.
  1891.  
  1892.           It should be noted that a user who creates an empty hash relation
  1893.           using  the  CREATE command and then copies a large UNIX file into
  1894.           it using COPY will create a very inefficient structure.  This  is
  1895.           because  a  relatively small default number of primary pages will
  1896.           have been specified by CREATE and overflow chains will  be  long.
  1897.  
  1898.           A better strategy is to COPY into an unsorted table so that MODI-
  1899.           FY can subsequently make a good guess at the  number  of  primary
  1900.           pages to allocate.
  1901.  
  1902.           6.2  DEFERRED UPDATE AND RECOVERY
  1903.  
  1904.           Any updates (APPEND, DELETE, REPLACE) are  processed  by  writing
  1905.           the tuples to be added changed or modified into a temporary file.
  1906.           When process 3 finishes, it calls process 4 to  actually  perform
  1907.           the  modifications  requested as a final step in processing.  De-
  1908.           ferred update is done for four reasons.
  1909.  
  1910.           a)  Secondary index considerations. Suppose  the  following  QUEL
  1911.           statement is executed;
  1912.  
  1913.                     RANGE OF E IS EMPLOYEE
  1914.                     REPLACE E(SALARY = 1.1*E.SALARY)  WHERE
  1915.                          E.SALARY > 20000
  1916.  
  1917.           Suppose further that there is a secondary  index  on  the  salary
  1918.           domain and the primary relation is keyed on another domain.
  1919.  
  1920.           OVQP in finding the employees who qualify for the raise will  use
  1921.           the  secondary  index.   If one employee (say Smith qualifies and
  1922.           his tuple is modified and the secondary index updated)  then  the
  1923.           scan of the secondary index will find his tuple a second time (in
  1924.           fact an arbitrary number of  times).   Either  secondary  indexes
  1925.           cannot  be used to identify qualifying tuples when range qualifi-
  1926.           cations are present (a rather unnatural restriction) or secondary
  1927.           indices must be updated in deferred mode.
  1928.  
  1929.           b)  Primary relation considerations. Suppose the  following  QUEL
  1930.           statement is executed
  1931.  
  1932.                     RANGE OF E, M IS EMPLOYEE
  1933.                     REPLACE E(SALARY = .9*E.SALARY)  WHERE
  1934.                          E. MGR = M.NAME
  1935.                            AND
  1936.                          E.SALARY > M.SALARY
  1937.  
  1938.           for the following EMPLOYEE relation
  1939.  
  1940.                           NAME    SAL     MANAGE
  1941.                           Smith   10k      Jones
  1942.                           Jones    8k
  1943.                           Brown  9.5k      Smith
  1944.  
  1945.           Logically Smith should get the pay  cut  but  Brown  should  not.
  1946.           However,  if Smith's tuple is updated before Brown is checked for
  1947.           the pay cut, Brown will qualify.  This undesirable situation must
  1948.           be avoided by deferred update.
  1949.  
  1950.           c)  Functionality of updates.  Suppose the following QUEL  state-
  1951.           ment is executed.
  1952.  
  1953.                     RANGE of E,M is EMPLOYEE
  1954.                     REPLACE E(SALARY = M.SALARY)
  1955.  
  1956.           This update attempts to assign to each  employee  the  salary  of
  1957.           every  other employee, i.e.  a single data item is to be replaced
  1958.           by multiple values.  Stated differently,  the  REPLACE  statement
  1959.           does  not specify a function.  This non-functionality can only be
  1960.           checked if deferred update is performed.
  1961.  
  1962.           d)  Recovery is easier. The deferred update file provides  a  log
  1963.           of updates to be made.  Recovery is provided upon system crash by
  1964.           the RESTORE command.  In this case the deferred update routine is
  1965.           requested to destroy the temporary file if it has not yet started
  1966.           processing it.  If it has begun processing,  it  reprocesses  the
  1967.           entire update file which is done in such a way that the effect is
  1968.           the same as if it were processed exactly once from start to  fin-
  1969.           ish.
  1970.  
  1971.           Hence the update is "backed out" if deferred updating has not yet
  1972.           begun;  otherwise it is processed to conclusion.  The software is
  1973.           designed so the update file can be optionally spooled  onto  tape
  1974.           and  recovered  from  tape.   This  added  feature should soon be
  1975.           operational.
  1976.  
  1977.           If a user from the terminal monitor (or a  C-program)  wishes  to
  1978.           stop  a  command  he can issue a "break" character.  In this case
  1979.           all processes reset execept the deferred update program which re-
  1980.           covers in the same manner as above.
  1981.  
  1982.           All update commands do deferred update; however the INGRES utili-
  1983.           ties  have  not  yet  been modified to do likewise.  When this is
  1984.           completed INGRES will recover from all crashes  which  leave  the
  1985.           disk  intact.   In  the meantime there can be disk-intact crashes
  1986.           which cannot be recovered in this manner (if they happen in  such
  1987.           a way that the system catalogs are left inconsistent).
  1988.  
  1989.           The INGRES "super-user" can checkpoint a data base(s)  onto  tape
  1990.           using  the  UNIX  backup  scheme.  Since INGRES logs all interac-
  1991.           tions, a consistent system can always be obtained (albeit slowly)
  1992.           by  restoring the last checkpoint and running the log of interac-
  1993.           tions  (or the tape(s) of deferred updates if it exists).
  1994.  
  1995.           7  CONCLUSION AND FUTURE EXTENSIONS
  1996.  
  1997.           The system described herein is in use at 5 installations  and  is
  1998.           being  brought up at 8 others.  It forms the basis of an account-
  1999.           ing system, a system for managing  student  records,  a  geo-data
  2000.           system,  a  system  for  maintaining a wiring diagram for a large
  2001.           telelphone  company  and  assorted  other  smaller  applications.
  2002.           These  applications  have  been running for periods of up to nine
  2003.           months.
  2004.  
  2005.           7.1  PERFORMANCE
  2006.  
  2007.           At this time no detailed performance measurements have been made.
  2008.           However,  on  our  system  (an  11/40 mainframe with 80k words of
  2009.           core) about 4-6 simultaneous INGRES users can be  supported  with
  2010.           reasonable  response  time  (assuming they are doing interactions
  2011.           which affect a small number of tuples and for which a fast access
  2012.           path  exists.   Of  course, a user has the ability to execute in-
  2013.           teractions in INGRES  which  require  hours  to  process).   This
  2014.           hardware configuration costs about $60,000.  Larger 11/70 instal-
  2015.           lations should be able to run substantially more INGRES users.
  2016.  
  2017.           The sizes of the processes in INGRES are indicated below.   Since
  2018.           the  access  methods  are  loaded with processes 2 and 3 and with
  2019.           many of the utilities their contribution to the  respective  pro-
  2020.           cess sizes has been noted separately.
  2021.  
  2022.                   access methods (AM)             11 K (bytes)
  2023.                   terminal monitor                10 K
  2024.                   EQUEL                           30 K + AM
  2025.                   process 2                       45 K + AM
  2026.                   process 3 (query processor)     45 K + AM
  2027.                   utilities (8 overlays)          160 K + AM
  2028.  
  2029.           7.2  USER FEEDBACK
  2030.  
  2031.           The feedback from internal and external users has been overwhelm-
  2032.           ingly  positive.   In this section we indicate features that have
  2033.           been suggested for future systems.
  2034.  
  2035.           a)  higher performance
  2036.  
  2037.           Earlier versions of INGRES were very slow.  The  current  version
  2038.           should alleviate this problem.
  2039.  
  2040.           b)  recursion
  2041.  
  2042.           QUEL does not support recursion.  Hence, recursion must be  tedi-
  2043.           ously  programmed in C using the precompiler.  This has been sug-
  2044.           gested as a desired extension.
  2045.  
  2046.           c)  other language extensions
  2047.  
  2048.           These include user defined functions (especially counters),  mul-
  2049.           tiple  target  lists for a single qualification statement and if-
  2050.           then-else control structures in QUEL.  These extensions  are  all
  2051.           so a user can avoid using the precompiler.
  2052.  
  2053.           d)  report generator
  2054.  
  2055.           PRINT is only a very primitive report generator.   The  need  for
  2056.           augmented facilities in this area is clear.  It should be written
  2057.           in EQUEL.
  2058.  
  2059.           e)   bulk copy
  2060.  
  2061.           The COPY routine fails to handle easily all situations that  have
  2062.           arisen.
  2063.  
  2064.           7.3  FUTURE EXTENSIONS
  2065.  
  2066.           Noted throughout the paper are areas where system improvement  is
  2067.           in  progress, planned or desired by users.  Other areas of exten-
  2068.           sion include the following
  2069.  
  2070.           a)  A multi-computer system version of INGRES to operate on  dis-
  2071.           tributed data bases
  2072.  
  2073.           b)  Further performance enhancements
  2074.  
  2075.           c)  A higher level user language including recursion and user de-
  2076.           fined functions
  2077.  
  2078.           d)  Better data definition and integrity features
  2079.  
  2080.           e)  A data base administrator advisor.  This program would run at
  2081.           idle  priority and issue queries against a statistics relation to
  2082.           be kept by INGRES.  It could then offer advice to a DBA  concern-
  2083.           ing  the  choice  of access methods and the selection of indices.
  2084.           This topic is discussed further in [HELD75b].
  2085.  
  2086.           ACKNOWLEDGEMENT
  2087.  
  2088.           Besides the authors, the following persons have played an  active
  2089.           role  in  the  design  and implementation of INGRES: Eric Allman,
  2090.           Rick Berman, Jim Ford, Angela Go, Nancy  McDonald,  Peter  Rubin-
  2091.           stein, Iris Schoenberg, Nick Whyte, Carol Williams, Karel Yousse-
  2092.           fi, Bill Zook.
  2093.  
  2094.           Support for the project has come from ARO23007,  DAHC04-74-G0087,
  2095.           NESCN0039-76-C-0022,     NSFF44620-71-C-0087,    JSEPDCR75-03839,
  2096.           NSFENG74-06651-AO1,  and  a  grant  from  the  Sloan  Foundation.
  2097.  
  2098.      REFERENCES
  2099.  
  2100.      ALLM76   Allman, E., Stonebraker, M., and Held, G.  "Embedding  a
  2101.               Relational  Data  Sub-language in a General Purpose Pro-
  2102.               gramming Language.", Proc. ACM  SIGPLAN-SIGMOD  Workshop
  2103.               on Data, Salt Lake City, Utah, March, 1976.
  2104.      ASTR76   Astrahan, M. et. al., "SYSTEM R: A  Relational  Approach
  2105.               to Data Base Management," TODS, Vol 1, No. 2.
  2106.      BOYC73   Boyce, R. et. al., "Specifying Queries as Relational Ex-
  2107.               pressions:  SQUARE",  IBM  Research,  San  Jose, Ca., RJ
  2108.               1291, Oct. 1973.
  2109.      CHAM74   Chamberlin, D. and Boyce, R., "SEQUEL: A Structured  En-
  2110.               glish  Query Language", Proc. 1974 ACM-SIGFIDET Workshop
  2111.               on Data Description,  Access  and  Control,  Ann  Arbor,
  2112.               Mich., May 1974.
  2113.      CHAM75   Chamberlin, D., Gray, J.N., and Traiger,  I.L.,  "Views,
  2114.               Authorization and Locking in a Relational Data Base Sys-
  2115.               tem", Proc. 1975  National  Computer  Conference,  AFIPS
  2116.               Press, May 1975.
  2117.      CODA71   Committee on Data Systems Languages, "CODASYL Data  Base
  2118.               Task Group Report", ACM, New York, 1971.
  2119.      CODD70   Codd, E.F., "A Relational Model of Data for Large Shared
  2120.               Data  Banks",  CACM,  Vol.  13 No. 6, pp. 377-387, June,
  2121.               1970.
  2122.      CODD71   Codd, E.F., "A Data Base Sublanguage Founded on the  Re-
  2123.               lational  Calculus", Proc. 1971 ACM-SIGFIDET Workshop on
  2124.               Data Description, Access and Control,  San  Diego,  Ca.,
  2125.               Nov. 1971.
  2126.      CODD72   Codd, E.F., "Relational Completeness of Data  Base  Sub-
  2127.               languages",  Courant  Computer  Science Symposium 6, May
  2128.               1972.
  2129.      CODD74   Codd, E.F. and  Date,  C.J.,  "Interactive  Support  for
  2130.               Non-Programmers, The Relational and Network Approaches",
  2131.               Proc.  1974 ACM-SIGFIDET  Workshop on  Data  Description,
  2132.           Access and Control, Ann Arbor, Mich., May 1974.
  2133.      DATE74   Date, C.J. and Codd, E.F., "The Relational  and  Network
  2134.               Approaches: Comparison of the Aplication Programming In-
  2135.               terfaces", Proc.  1974  ACM-SIGFIDET  Workshop  on  Data
  2136.               Description,  Access  and Control, Ann Arbor, Mich., May
  2137.               1974.
  2138.      GRAY75   Gray, J.N., Lorie, R.A., and Putzolu, G.R.  "Granularity
  2139.               of  Locks  in  a  Shared  Data Base" Proc. International
  2140.               Conference on Very Large Data Bases, Framingham,  Mass.,
  2141.               September, 1975.
  2142.      GO75     Go, A., Stonebraker, M., and Williams, C., "An  Approach
  2143.               to   Implementing   a   Geo-data   System",   Proc.  ACM
  2144.               SIGGRAPH/SIGMOD Conference on Data Bases in  Interactive
  2145.               Design, Waterloo, Ontario, Sept. 1975.
  2146.      GOTT75   Gottlieb, D., et. al.  "A Classification of  Compression
  2147.               Methods  and their Usefulness in a Large Data Processing
  2148.               Center" Proc. 1975 National Computer  Conference,  AFIPS
  2149.               Press, May, 1975.
  2150.      HELD75a  Held, G.D., Stonebraker, M. and Wong, E.,  "INGRES  -  A
  2151.               Relational  Data Base Management System", Proc. 1975 Na-
  2152.               tional Computer Conference, AFIPS Press, 1975.
  2153.      HELD75b  Held, G.D., "Storage Structures for Relational Data Base
  2154.               Management  Systems",  Ph.D. Thesis, Dept. of Electrical
  2155.               Engineering and Computer Science, Univ.  of  California,
  2156.               Berkeley, 1975.
  2157.      HELD75c  Held, G., and Stonebraker M., "B-Trees Re-examined",  to
  2158.               appear in CACM.
  2159.      IBM66    IBM Corp., "OS ISAM Logic",  IBM,  White  Plains,  N.Y.,
  2160.               GY28-6618.
  2161.      JOHN74   Johnson, S.C., "YACC,  Yet  Another  Compiler-Compiler",
  2162.               UNIX  Programmer's  Manual,  Bell Telephone Labs, Murray
  2163.               Hill, N.J., July 1974.
  2164.      MCDO75a  McDonald, N. and Stonebraker, M., "Cupid -- The Friendly
  2165.               Query  Language",  Proc.  ACM-Pacific-75, San Francisco,
  2166.               California, April 1975.
  2167.      MCDO75b  McDonald, Nancy., "CUPID: A Graphics  Oriented  Facility
  2168.               for  Support  of Non-programmer Interactions with a Data
  2169.               Base", Ph.D. Thesis, Dept. of Electrical Engineering and
  2170.               Computer  Science,  University  of California, Berkeley,
  2171.               1975.
  2172.      RITC74   Ritchie, D.M. and Thompson, K.  "The  UNIX  Tine-Sharing
  2173.               System," CACM, Vol. 17, No. 3., March, 1974.
  2174.      SCHO75   Schoenberg,  Iris,  "Implementation  of  Integrity  Con-
  2175.               straints  in the Relational Data Base Management System,
  2176.               INGRES", M.S. Thesis, Dept.  of  Electrical  Engineering
  2177.               and  Computer  Science, University of California, Berke-
  2178.               ley, 1975.
  2179.      STON74a  Stonebraker, M., "A Functional  View  of  Data  Indepen-
  2180.               dence,"  Proc.  1974  SIGFIDET Workshop on Data Descrip-
  2181.               tion, Access and Control, Ann Arbor, Mich., May 1974.
  2182.      STON74b  Stonebraker, M. and Wong, E., "Access Control in a Rela-
  2183.               tional  Data  Base  Management System by Query Modifica-
  2184.               tion", Proc. 1974 ACM National Conference, San Diego,
  2185.           Ca., Nov. 1974
  2186.      STON74c  Stonebraker, M., "High Level Integrity Assurance in  Re-
  2187.               lational  Data  Base Systems", University of California,
  2188.               Electronics Research Laboratory, Memo ERL-M473,  August,
  2189.               1974.
  2190.      STON75    Stonebraker,  M.,  "Implementation  of  Integrity  Con-
  2191.               straints  and  Views  by  Query Modification", Proc 1975
  2192.               SIGMOD Workshop on Management of Data,  San  Jose,  Ca.,
  2193.               May 1975.
  2194.      STON76   Stonebraker, M. and Rubinstein, P., "The INGRES  Protec-
  2195.               tion  System," Proc. 1976 ACM National Conference, Hous-
  2196.               ton, Texas, October, 1976.
  2197.      TSIC75   Tsichritzis, D., "A Network Framework for Relational Im-
  2198.               plementation",  University  of Toronto, Computer Systems
  2199.               Research Group Report CSRG-51, Feb. 1975
  2200.      WONG76   Wong, E. and Youssefi, K., "Decomposition-A Strategy for
  2201.               Query Processing," TODS, (this issue).
  2202.      ZOOK76   Zook, W., et. al., "INGRES - Reference  Manual  (Version
  2203.               5)",  University of California, Electronics Research La-
  2204.               boratory, Memo. No. ERL-M585, April, 1976.
  2205.  
  2206.